This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1210. Injection of elaborated-type-specifier in enumeration scope

Section: 6.4.2  [basic.scope.pdecl]     Status: C++11     Submitter: Johannes Schaub     Date: 2010-10-13

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

According to 6.4.2 [basic.scope.pdecl] paragraph 6,

for an elaborated-type-specifier of the form

if the elaborated-type-specifier is used in the decl-specifier-seq or parameter-declaration-clause of a function defined in namespace scope, the identifier is declared as a class-name in the namespace that contains the declaration; otherwise, except as a friend declaration, the identifier is declared in the smallest non-class, non-function-prototype scope that contains the declaration.

This should have been, but was not, updated when enumeration scope (6.4.8 [basic.scope.enum]) was added:

    enum class E {
        e = sizeof((struct S*)0)
    };

Presumably the name S belongs to the same scope as E, not the enumeration scope of E.