Description
Full name of submitter: Brian Bi
Issue description: [dcl.align]/1 permits alignment specifiers to be applied to references. p4 then specifies that an alignment specifier affects the "alignment requirement" of the entity, but this is meaningless for a reference.
There is implementation divergence, with GCC and MSVC permitting an alignment specifier with any value for a reference, while Clang and EDG treat the natural alignment of a reference as being equal to that of a pointer and disallow weaker alignment specifiers. However, note that it is not possible to query the alignment of a reference, since alignof
accepts only types.
Suggested resolution: Edit [dcl.align]/1 as follows, with a drive-by fix for the fact that static data members are already variables:
An alignment-specifier may be applied to a variable or to a
classnon-static data member, but it shall not be applied to a reference, a bit-field, a function parameter, or an exception-declaration ([except.handle]). [...]
Alternatively, we could allow it, leaving [dcl.align]/1 alone and perhaps edit [dcl.align]/4:
The effect of an alignment-specifier applied to a reference is implementation-defined. Otherwise, the
Thealignment requirement of an entity is the strictest nonzero alignment specified by its alignment-specifiers, if any; otherwise, the alignment-specifiers have no effect.