N4266 / CWG 1657 / EWG 113
Richard Smith

Attributes for namespaces and enumerators


Change in 7.2 (dcl.enum) paragraph 1:

        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:

        inlineopt namespace attribute-specifier-seqopt identifier { namespace-body }
        inlineopt namespace attribute-specifier-seqopt original-namespace-name { namespace-body }
        inlineopt namespace attribute-specifier-seqopt { namespace-body }

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 (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.