-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter: Brian Bi
Reference (section label): [class.copy.ctor], [namespace.udecl]
Issue description: [class.copy.ctor]/5 states:
A declaration of a constructor for a class X is ill-formed if its first parameter is of type cv X and either there are no other parameters or else all other parameters have default arguments. A member function template is never instantiated to produce such a constructor signature.
This wording does not explain what happens if such a constructor signature is inherited from a base class; MSVC currently treats the using-declaration as ill-formed (https://godbolt.org/z/6x47rf4vT). We should say that such a constructor is excluded from the inherited set.
Also, the wording "never instantiated" doesn't explain at what step of the process instantiation stops. I doubt there would be any implementation divergence, but even still, we should be a bit more explicit and say the result is a substitution failure.
Suggested resolution:
Add a paragraph before [namespace.udecl]/13:
The set of declarations named by a using-declarator that inhabits a class
C
does not include any constructor whose first parameter has type cvC
and all of whose remaining parameters (possibly none) have default arguments.
Edit [class.copy.ctor]/5:
A declaration of a constructor for a class
X
is ill-formed if its first parameter is of typeX
and either there are no other parameters or else all other parameters have default arguments.A member function template is never instantiated to produce such a constructor signature.During type deduction for a constructor template ofX
([temp.deduct.general]), if substitution produces such a constructor signature, type deduction fails.
In Example 5 to [class.copy.ctor]/5, edit the comment:
//
does not instantiate the member template to producenoS::S<S>(S);
S::S<S>(S)
candidate generated from the member template;
//usesthe implicitly declared copy constructor is used