Created on 2009-03-19.00:00:00 last changed 186 months ago
Although the current wording does specify the outcome, it is not immediately apparent what the result of an example like the following should be:
template<std::ObjectType T> struct S { requires std::CopyConstructible<T> S(const S&) = default; };
The outcome (that S will have an implicitly-declared copy constructor that is defined as deleted in specializations in which T is not copy-constructible) would be clearer with the addition of two notes. First, it would be helpful if 13.7.2 [temp.class] paragraph 5, which currently reads,
A constrained member (11.4 [class.mem]) in a class template is declared only in class template specializations in which its template requirements (_N2914_.14.11.1 [temp.req]) are satisfied (_N2914_.14.11.1.1 [temp.req.sat])...
had a note or footnote to the effect,
When a constrained member of a template is a special member function, and when, in an instantiation, the member is not declared because its requirements are not satisfied, the special member is considered not to have been “explicitly declared” (i.e., the member is not user-declared); therefore a declaration may still be implicitly generated as specified in 11.4.4 [special].
The fact that the implicitly-declared copy constructor in this case is defined as deleted would be clearer if somewhere in the second list in 11.4.5.3 [class.copy.ctor] paragraph 5, which currently reads
...An implicitly-declared copy constructor for a class X is defined as deleted if X has:
a variant member with a non-trivial copy constructor and X is a union-like class,
a non-static data member of class type M (or array thereof) that cannot be copied because overload resolution (12.2 [over.match]), as applied to M's copy constructor, results in an ambiguity or a function that is deleted or inaccessible from the implicitly-declared copy constructor, or
a direct or virtual base class B that cannot be copied because overload resolution (12.2 [over.match]), as applied to B's copy constructor, results in an ambiguity or a function that is deleted or inaccessible from the implicitly-declared copy constructor.
there were a cross-reference to _N2914_.14.11.2.1 [temp.archetype.assemble], whose third paragraph reads,
If no requirement specifies a copy constructor for a type T, a copy constructor is implicitly declared (11.4.5.3 [class.copy.ctor]) in the archetype of T with the following signature:T(const T&) = delete;
History | |||
---|---|---|---|
Date | User | Action | Args |
2009-08-03 00:00:00 | admin | set | status: open -> concepts |
2009-03-19 00:00:00 | admin | create |