Created on 2002-05-19.00:00:00 last changed 196 months ago
[Voted into WP at October 2004 meeting.]
Proposed Resolution (October 2003):
Note that the change here interacts with issue 432.
Add the following as a new paragraph immediately following 6.4.2 [basic.scope.pdecl] paragraph 2:
The point of declaration for a class first declared by a class-specifier is immediately after the identifier or template-id (if any) in its class-head (Clause 11 [class]). The point of declaration for an enumeration is immediately after the identifier (if any) in its enum-specifier (9.7.1 [dcl.enum]).
Change point 1 of 6.4.7 [basic.scope.class] paragraph 1 to read:
The potential scope of a name declared in a class consists not only of the declarative region following the name'sdeclaratorpoint of declaration, but also of all function bodies, default arguments, and constructor ctor-initializers in that class (including such things in nested classes).
[Note that the preceding change duplicates one of the changes in the proposed resolution of issue 432.]
Change 13.9.3 [temp.explicit] paragraph 2 to read:
If the explicit instantiation is for a member function, a member class or a static data member of a class template specialization, the name of the class template specialization in the qualified-id for the memberdeclaratorname shall be a template-id.
Add the following as paragraph 5 of Clause 11 [class]:
If a class-head contains a nested-name-specifier, the class-specifier shall refer to a class that was previously declared directly in the class or namespace to which the nested-name-specifier refers (i.e., neither inherited nor introduced by a using-declaration), and the class-specifier shall appear in a namespace enclosing the previous declaration.
Delete 11.3 [class.name] paragraph 4 (this was added by issue 284):
When a nested-name-specifier is specified in a class-head or in an elaborated-type-specifier, the resulting qualified name shall refer to a previously declared member of the class or namespace to which the nested-name-specifier 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.
Notes from October 2003 meeting:
We feel this case should get an error.
We had a user complain that our compiler was allowing the following code:
struct B { struct S; }; struct D : B { }; struct D::S { };
We took one look at the code and made the reasonable (I would claim) assumption that this was indeed a bug in our compiler. Especially as we had just fixed a very similar issue with the definition of static data members.
Imagine our surprise when code like this showed up in Boost and that every other compiler we tested accepts this code. So is this indeed legal (it seems like it must be) and if so is there any justification for this beyond 6.5.5.2 [class.qual]?
John Spicer: The equivalent case for a member function is covered by the declarator rules in 9.3.4 [dcl.meaning] paragraph 1. The committee has previously run into cases where a restriction should apply to both classes and non-classes, but fails to do so because there is no equivalent of 9.3.4 [dcl.meaning] paragraph 1 for classes.
Given that, by the letter of the standard, I would say that this case is allowed.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2005-05-01 00:00:00 | admin | set | status: dr -> wp |
2004-11-07 00:00:00 | admin | set | status: ready -> dr |
2004-04-09 00:00:00 | admin | set | status: review -> ready |
2004-02-13 00:00:00 | admin | set | messages: + msg952 |
2003-11-15 00:00:00 | admin | set | messages: + msg925 |
2003-11-15 00:00:00 | admin | set | messages: + msg924 |
2003-11-15 00:00:00 | admin | set | status: open -> review |
2002-05-19 00:00:00 | admin | create |