Title
Multiple alignas specifiers
Status
drafting
Section
9.12.2 [dcl.align]
Submitter
Mike Herrick

Created on 2016-01-12.00:00:00 last changed 81 months ago

Messages

Date: 2017-02-15.00:00:00

Notes from the February, 2017 meeting:

CWG agreed that the intent of the wording is that the “strictest” requirement is intended to apply to a single declaration, and the requirement for compatibility should apply to all declarations, whether the entity is defined or not.

Date: 2018-02-27.00:00:00

According to 9.12.2 [dcl.align] paragraph 4,

The alignment requirement of an entity is the strictest non-zero alignment specified by its alignment-specifiers, if any; otherwise, the alignment-specifiers have no effect.

It is not clear whether this applies to specifiers within a single declaration, or if it is intended to apply to the union of all declarations.

Similarly, paragraph 6 says,

If the defining declaration of an entity has an alignment-specifier, any non-defining declaration of that entity shall either specify equivalent alignment or have no alignment-specifier. Conversely, if any declaration of an entity has an alignment-specifier, every defining declaration of that entity shall specify an equivalent alignment. No diagnostic is required if declarations of an entity have different alignment-specifiers in different translation units.

This only talks about agreement between definitions and non-defining declarations. What about an example where an entity is not defined but is declared with different alignment-specifiers?

  struct alignas(16) A;
  struct alignas(32) A;

If A is not defined, is this, or should it be, ill-formed?

History
Date User Action Args
2018-02-27 00:00:00adminsetmessages: + msg5904
2018-02-27 00:00:00adminsetstatus: open -> drafting
2016-01-12 00:00:00admincreate