Skip to content
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 "()" does not match "initializer" grammar term #2847

Open
randomnetcat opened this issue Apr 27, 2019 · 2 comments
Labels
cwg Issue must be reviewed by CWG.

Comments

@randomnetcat
Copy link
Contributor

[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 (including default initialization in the context of copy-initialization), the candidate functions are all the converting constructors ([class.conv.ctor]) of that class. The argument list is the expression-list or assignment-expression of the initializer.

Default-initialization invokes this clause with "the initializer ()" (see #2846) for class types. This clause has a similar issue.

The sentence "The argument list is the expression-list or assignment-expression of the initializer" uses the initializer grammar term:

initializer:

  • brace-or-equal-initializer
  • ( expression-list )

This does not accept ().

Thus, this clause has no ability to handle invoking a default constructor, such as default-initialization intends to invoke for class types.

@zygoloid zygoloid added the cwg Issue must be reviewed by CWG. label Apr 29, 2019
@zygoloid
Copy link
Member

This should be handled by the resolution of #2846; () should be an initializer.

@zygoloid
Copy link
Member

... but we're also missing an "if any" after "the expression-list" here.

@jensmaurer jensmaurer changed the title [over.match.ctor] Initialization by "()" does not match "initializer" grammer term [over.match.ctor] Initialization by "()" does not match "initializer" grammar term May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

No branches or pull requests

2 participants