Created on 2002-08-23.00:00:00 last changed 178 months ago
[Voted into WP at March, 2010 meeting as document N3064.]
Proposed resolution (February, 2010):
Change 9.3.4 [dcl.meaning] as follows:
...A declarator-id shall not be qualified except for the definition of a member function (11.4.2 [class.mfct]) or static data member (11.4.9 [class.static]) outside of its class, the definition or explicit instantiation of a function or variable member of a namespace outside of its namespace, or the definition ofa previously declaredan explicit specialization outside of its namespace, or the declaration of a friend function that is a member of another class or namespace (11.8.4 [class.friend]). When the declarator-id is qualified, the declaration shall refer to a previously declared member of the class or namespace to which the qualifier refers (or of an inline namespace within that scope (9.8.2 [namespace.def])) or to a specialization thereof, and the member shall not have been introduced by a using-declaration in the scope of the class or namespace nominated by the nested-name-specifier of the declarator-id. [Note:...
Change 13.9.4 [temp.expl.spec] paragraphs 2-4 as follows:
An explicit specialization shall appear in namespace scope. An explicit specialization whose declarator-id is not qualified shall be declared in the nearest enclosing namespace of the template, or, if the namespace is inline (9.8.2 [namespace.def]), any namespace from its enclosing namespace set. Such a declaration may also be a definition.
If the declaration is not a definition, the specialization may be defined later (_N4868_.9.8.2.3 [namespace.memdef]).A declaration of a function template or class template being explicitly specialized shall
be in scope at the point ofprecede the declaration ofanthe explicit specialization. [Note: a declaration, but not a definition of the template is required. —end note] The definition of a class or class template shallbe in scope at the point ofprecede the declaration of an explicit specialization for a member template of the class or class template. [Example: ... —end example]A member function, a member class or a static data member of a class template may be explicitly specialized for a class specialization that is implicitly instantiated; in this case, the definition of the class template shall
be in scope at the point of declaration ofpreced the explicit specialization for the member of the class template. If such an explicit specialization for the member of a class template names an implicitly-declared special member function ( 11.4.4 [special]), the program is ill-formed.
Notes from October 2002 meeting:
There was agreement that we wanted to allow this.
This case is nonstandard by 9.3.4 [dcl.meaning] paragraph 1 (there is a requirement that the specialization first be declared within the namespace before being defined outside of the namespace), but probably should be allowed:
namespace NS1 { template<class T> class CDoor { public: int mtd() { return 1; } }; } template<> int NS1::CDoor<char>::mtd() { return 0; }
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | messages: + msg2702 |
2010-03-29 00:00:00 | admin | set | status: review -> cd2 |
2010-02-16 00:00:00 | admin | set | messages: + msg2541 |
2010-02-16 00:00:00 | admin | set | status: drafting -> review |
2002-11-08 00:00:00 | admin | set | messages: + msg751 |
2002-11-08 00:00:00 | admin | set | status: open -> drafting |
2002-08-23 00:00:00 | admin | create |