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
[over.match.ctor] Initialization by "()" neither is copy-initialization nor direct-initialization. #1911
Comments
(When) is it not covered by [dcl.init]/16?
|
Because "(a)" is different from "()". That's how I read it, even though I wish it was clearer. But, if it was covered by that, then "For direct-initialization or default-initialization that is not in the context of copy-initialization ..." could be simplified to "For direct-initialization ..." straight away. And we could always use explicit constructors in the context of copy-list-initializations. Which seems... odd and against the intentions. |
I mean, can the initializer "()" appear outside of new expressions, functional notation type conversions, or mem-initializers (i.e. the contexts listed after "as well as in")? (I think |
Here, we are told by list-initialization clauses, to value-initialize Ok, now that you mention new-expressions, functional notation type conversions etc, I can see why it's deeply confusing. Yes, I agree, I think in some cases |
And we use \grammarterm for "the initializer |
Editorial meeting consensus: First issue, fixed by "For copy-initialization (including default initialization in the context of copy-initialization), the candidate functions are all the converting constructors of that class." |
Over.match.ctor says
"When objects of class type are direct-initialized, copy-initialized from an expression of the same or a derived class type ([dcl.init]), or default-initialized, overload resolution selects the constructor. For direct-initialization or default-initialization that is not in the context of copy-initialization, the candidate functions are all the constructors of the class of the object being initialized. For copy-initialization, the candidate functions are all the converting constructors of that class. "
The last sentence should consider the remaining default initialization cases aswell that happened in the context of copy(-list)-initializatizion. Suggested edit:
"For copy-initialization and the remaining default-initialization cases, the candidate functions are all the converting constructors of that class."
Note that initialization by "()" is not copy-initializaton (neither is it direct initialization), so this change is normatively relevant. However, I think the current intent is sufficiently clear so this could be handled editorially.
The text was updated successfully, but these errors were encountered: