Created on 2010-06-19.00:00:00 last changed 130 months ago
[Voted into the WP at the March, 2011 meeting.]
Proposed resolution (November, 2010):
Merge 11.4.5.3 [class.copy.ctor] paragraphs 6 and 7 and change the text as follows:
A declaration of a constructor for a class X is ill-formed if its first parameter is of type (optionally cv-qualified) X and either there are no other parameters or else all other parameters have default arguments. A member function template is never instantiated to
perform the copy of a class object to an object of its class typeproduce such a constructor signature. [Example:struct S { template<typename T> S(T);template<typename T> S(T&&);S(); };S f();constS g; void h() {S a( f() ); // does not instantiate member template; // uses the implicitly generated move constructorS a(g); // does not instantiate the member template to produce S::S<S>(S); // uses the implicitlygenerateddeclared copy constructor }
11.4.5.3 [class.copy.ctor] paragraphs 6-7 currently read,
A declaration of a constructor for a class X is ill-formed if its first parameter is of type (optionally cv-qualified) X and either there are no other parameters or else all other parameters have default arguments.
A member function template is never instantiated to perform the copy of a class object to an object of its class type. [Example:
struct S { template<typename T> S(T); template<typename T> S(T&&); S(); }; S f(); const S g; void h() { S a( f() ); // does not instantiate member template; // uses the implicitly generated move constructor S a(g); // does not instantiate the member template; // uses the implicitly generated copy constructor }
These paragraphs were previously a single paragraph, and the second sentence was intended to mean that
template <class T> A(T):
will never be instantiated to produce A(A). It should not have been split and the example should not have been amended to include move construction.
Lawrence Crowl: I suggest something along the lines of
A member function template is never instantiated to match the signature of an ill-formed constructor.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | messages: + msg3369 |
2011-04-10 00:00:00 | admin | set | status: ready -> fdis |
2010-11-29 00:00:00 | admin | set | messages: + msg3060 |
2010-11-29 00:00:00 | admin | set | status: drafting -> ready |
2010-06-19 00:00:00 | admin | create |