-
Notifications
You must be signed in to change notification settings - Fork 385
HugeArray: simplify the initialization of the buffer field #2391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HugeArray: simplify the initialization of the buffer field #2391
Conversation
|
The description is lacking.
|
The span still gets initialized, right? It is done by its trivial constructor now.
I baffled why removing an invalid initializer should be justified, not the reverse. Out of all span constructors listed at https://en.cppreference.com/w/cpp/container/span.html which one can be passed with
I quoted the compiler's error message in the commit's description. What's unclear there?
|
Your commit message should say that.
Your commit message does not explain that the code is invalid. It only says it "simplifies" an initializer (which it does not) and cites the error by a C++ compiler that, by the description on its own home page, is not C++23 compliant. This sounds like you want to work around a compiler bug, because your commit message does not claim that MPD code is bad. If you claim that MPD code is bad and should be fixed, your commit message should describe that. Text posted here does not count. The commit message should say it. |
Nit: it's the default constructor. And this default constructor is, by definition, not trivial. |
|
Hmm, I'm a bit confused now. The minified example fails to compile in Clang 19 too: ... but it somehow works when compiling MPD. I'll try to amend the commit message as much as I can, though. |
The default constructor is never called in MPD and thus never instantiated. A template that is never instantiated will not throw this compiler error. I believe the strict behavior of EDG is a compiler bug. EDG cannot prove that a certain template overload of std::span does not have a constructor accepting We do know that. The MPD code is bad, it's a MPD bug, but one that never materializes. It's in dead code, therefore it has no practical relevance. It is only a theoretical bug. Yet your commit message failed to describe this and is insufficient (and even wrong). |
It is invalid to initialize a std::span<std::byte> with nullptr. The code was compiling fine, however, because most compilers do not try to instantiate this template, unless it is called somewhere in the code.
7ffb0d3 to
0dc9bbf
Compare
|
Is this better? |
|
Yes! |
This also fixes compilation with EDG-based C++ compilers:
error 289: no instance of constructor
"std::span<_Type, _Extent>::span [with _Type=std::byte, _Extent=18446744073709551615UL]"
matches the argument list