Title
Unclear requirements for multiple alignas specifiers
Status
cd4
Section
9.12.2 [dcl.align]
Submitter
Steve Clamage

Created on 2014-10-20.00:00:00 last changed 49 months ago

Messages

Date: 2015-10-15.00:00:00

[Moved to DR at the October, 2015 meeting.]

Date: 2015-05-15.00:00:00

Proposed resolution (May, 2015):

  1. Change 9.12.2 [dcl.align] paragraph 2 as follows:

  2. When the alignment-specifier is of the form alignas( constant-expression ):

    • the constant-expression shall be an integral constant expression;

    • if the constant expression evaluates to a fundamental alignment, the alignment requirement of the declared entity shall be the specified fundamental alignment

    • if the constant expression evaluates to an extended alignment and the implementation supports that alignment in the context of the declaration, the alignment of the declared entity shall be that alignment

    • if the constant expression does not evaluate to an alignment value (6.7.6 [basic.align]), or evaluates to an extended alignment and the implementation does not support that alignment in the context of the declaration, the program is ill-formed.

    • if the constant expression evaluates to zero, the alignment specifier shall have no effect

    • otherwise, the program is ill-formed.

  3. Change 9.12.2 [dcl.align] paragraph 4 as follows:

  4. When multiple alignment-specifiers are specified for an entity, the The alignment requirement shall be set to of an entity is the strictest specified non-zero alignment specified by its alignment-specifiers, if any; otherwise, the alignment-specifiers have no effect.
Date: 2014-10-20.00:00:00

The description of alignment-specifiers is unclear. For example, 9.12.2 [dcl.align] bullet 2.2 says,

if the constant expression evaluates to a fundamental alignment, the alignment requirement of the declared entity shall be the specified fundamental alignment

However, paragraph 4 says,

When multiple alignment-specifiers are specified for an entity, the alignment requirement shall be set to the strictest specified alignment.

meaning that a less-strict alignment will be ignored, rather than being the alignment of the entity, and presumably meaning that no diagnostic is required for an insufficiently-strict alignment if a more stringent requirement is also supplied.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: dr -> cd4
2015-11-10 00:00:00adminsetmessages: + msg6072
2015-11-10 00:00:00adminsetstatus: ready -> dr
2015-05-25 00:00:00adminsetmessages: + msg5454
2015-05-25 00:00:00adminsetstatus: drafting -> ready
2014-10-20 00:00:00admincreate