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
[Voted into WP at March, 2010 meeting.]
There is a lack of symmetry in the specification of attributes that apply to class and enum types. For example:
class X [[attr]]; // #1 typedef class Y [[attr]] YT; // #2
According to 9.2.9.5 [dcl.type.elab] paragraph 1, #1 associates the attr attribute with class X for all subsequent references. On the other hand, 9.3.4 [dcl.meaning] paragraph 5 says that #2 associates the attr attribute with the type but not with class Y.
Existing implementations (Microsoft, GNU, Sun) with attributes place an attribute that is intended to be associated with a class type between the class-key and the class name, and it would be preferable to adopt such an approach instead of the contextual approach in the current formulation.
Proposed resolution (October, 2009):
Change 6.4.2 [basic.scope.pdecl] bullet 6.1 as follows:
for a declaration of the form
the identifier is declared...
Change 6.5.6 [basic.lookup.elab] paragraph 2 as follows:
...unless the elaborated-type-specifier appears in a declaration with the following form:
class-key attribute-specifieropt identifier
attribute-specifieropt;the identifier is looked up... if the elaborated-type-specifier appears in a declaration with the form:
class-key attribute-specifieropt identifier
attribute-specifieropt;the elaborated-type-specifier is a declaration...
In 9.2.9.5 [dcl.type.elab], change the grammar and paragraph 1 as follows:
elaborated-type-specifier:
class-key attribute-specifieropt ::opr nested-name-specifieropt identifier
...An attribute-specifier shall not appear in an elaborated-type-specifier unless the latter is the sole constituent of a declaration. If an elaborated-type-specifier is the sole constituent of a declaration, the declaration is ill-formed unless it is an explicit specialization (13.9.4 [temp.expl.spec]), an explicit instantiation (13.9.3 [temp.explicit]) or it has one of the following forms:
class-key attribute-specifieropt identifier
attribute-specifieropt;
...
Change the grammar in 9.7.1 [dcl.enum] paragraph 1 as follows:
Change the grammar in Clause 11 [class] paragraph 1 as follows: