Created on 2004-11-03.00:00:00 last changed 130 months ago
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
Proposed resolution (October, 2006):
Remove the indicated words from 9.3.4 [dcl.meaning] paragraph 1:
...An unqualified-id occurring in a declarator-id shall be a simple identifier except for the declaration of some special functions (11.4.8 [class.conv], 11.4.7 [class.dtor], 12.4 [over.oper]) and for the declaration of template specializations or partial specializations (13.9 [temp.spec]).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 of a previously declared 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, 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...
[Drafting note: The omission of “outside of its class” here does not give permission for redeclaration of class members; that is still prohibited by 11.4 [class.mem] paragraph 1. The removal of the enumeration of the kinds of declarations in which a qualified-id can appear does allow a typedef declaration to use a qualified-id, which was not permitted before; if that is undesirable, the prohibition can be reinstated here.]
Notes from the April, 2006 meeting:
In discussing issue 548, the CWG agreed that the prohibition of qualified declarators inside their namespace should be removed.
According to 9.3.4 [dcl.meaning] paragraph 1,
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 of a previously declared 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...
This restriction prohibits examples like the following:
void f(); void ::f(); // error: qualified declarator namespace N { void f(); void N::f() { } // error: qualified declarator }
There doesn't seem to be any good reason for disallowing such declarations, and a number of implementations accept them in spite of the Standard's prohibition. Should the Standard be changed to allow them?
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2012-11-03 00:00:00 | admin | set | status: dr -> drwp |
2012-02-27 00:00:00 | admin | set | messages: + msg3808 |
2012-02-27 00:00:00 | admin | set | status: ready -> dr |
2011-09-06 00:00:00 | admin | set | status: review -> ready |
2006-11-05 00:00:00 | admin | set | messages: + msg1406 |
2006-11-05 00:00:00 | admin | set | status: drafting -> review |
2006-04-22 00:00:00 | admin | set | messages: + msg1331 |
2006-04-22 00:00:00 | admin | set | status: open -> drafting |
2004-11-03 00:00:00 | admin | create |