Proposed resolution (October 2002): As given in N1376=02-0034. Note that the inserts and strikeouts in
that document do not display
correctly in all browsers; <del> --> <strike>
and <ins> --> <b>, and the
similar changes for the closing delimiters,
seem to do the trick.
I have some concerns with the description of name lookup for
elaborated type specifiers in 6.5.6 [basic.lookup.elab]: Paragraph 2 has some parodoxical statements concerning looking up
names that are simple identifers: It is not clear how an elaborated-type-specifier can refer
to an enum-name or class-name given that the lookup does
not find such a name and that class-name and enum-name
are not part of the syntax of an elaborated-type-specifier. The second sentence quoted above seems to suggest that the name found
will not be used if it is not a class name. typedef-name names
are ill-formed due to the sentence preceding the quote. If lookup
finds, for instance, an enum-name then a new declaration will
be created. This differs from C, and from the enum case, and can have
surprising effects: Was this really the intent? If this is the case then some more
work is needed on 6.5.6 [basic.lookup.elab]. Note that the
section does not make finding a type template formal ill-formed, as is
done in 9.2.9.5 [dcl.type.elab]. I don't see anything that
makes a type template formal name a class-name. So the example
in 9.2.9.5 [dcl.type.elab] of friend class T; where
T is a template type formal would no longer be ill-formed
with this interpretation because it would declare a new class
T . (See also issue 254.)
If the elaborated-type-specifier refers to an enum-name
and this lookup does not find a previously declared enum-name,
the elaborated-type-specifier is ill-formed. If the
elaborated-type-specifier refers to an [sic]
class-name and this lookup does not find a previously declared
class-name... the elaborated-type-specifier is a
declaration that introduces the class-name as described in
6.4.2 [basic.scope.pdecl]."
struct S {
enum E {
one = 1
};
class E* p; // declares a global class E?
};