ISO/IEC JTC1 SC22 WG21
N4266 / CWG 1657 / EWG 113
Richard Smith
richard@metafoo.co.uk
2014-11-05

Attributes for namespaces and enumerators

Wording

Change in 7.2 (dcl.enum) paragraph 1:

[...]
enumerator:
        identifier attribute-specifier-seqopt
The optional attribute-specifier-seq in the enum-head and the opaque-enum-declaration appertains to the enumeration; the attributes in that attribute-specifier-seq are thereafter considered attributes of the enumeration whenever it is named. [...]

Change in 7.2 (dcl.enum) paragraph 2:

[...] The identifiers in an enumerator-list are declared as constants, and can appear wherever constants are required. An enumerator-definition with = gives the associated enumerator the value indicated by the constant-expression. If the first enumerator has no initializer, the value of the corresponding constant is zero. An enumerator-definition without an initializer gives the enumerator the value obtained by increasing the value of the previous enumerator by one. [ Example: … ] The optional attribute-specifier-seq in an enumerator appertains to that enumerator.

Change in 7.3 (namespace.def) paragraph 1:

[...]
original-namespace-definition:
        inlineopt namespace attribute-specifier-seqopt identifier { namespace-body }
extension-namespace-definition:
        inlineopt namespace attribute-specifier-seqopt original-namespace-name { namespace-body }
unnamed-namespace-definition:
        inlineopt namespace attribute-specifier-seqopt { namespace-body }
namespace-body:
        declaration-seqopt

Add a new paragraph after 7.3 (namespace.def) paragraph 7:

The optional attribute-specifier-seq in an original-namespace-definition or extension-namespace-definition appertains to the namespace being defined or extended.

Change in 7.3.1.1 (namespace.unnamed) paragraph 1:

An unnamed-namespace-definition behaves as if it were replaced by
inlineopt namespace unique { /* empty body */ }
using namespace unique ;
namespace attribute-specifier-seq unique { namespace-body }
where inline appears if and only if it appears in the unnamed-namespace-definition, all occurrences of unique in a translation unit are replaced by the same identifier, and this identifier differs from all other identifiers in the entire program. [Footnote: …] The optional attribute-specifier-seq in the unnamed-namespace-definition appertains to unique.

Change in 7.6.5 (dcl.attr.deprecated) paragraph 2:

The attribute may be applied to the declaration of a class, a typedef-name, a variable, a non-static data member, a function, a namespace, an enumeration, an enumerator, or a template specialization.