This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


1706. alignas pack expansion syntax

Section: 9.12.1  [dcl.attr.grammar]     Status: drafting     Submitter: Daveed Vandevoorde     Date: 2013-06-26

The grammar for alignment-specifier in 9.12.1 [dcl.attr.grammar] paragraph 1 is:

where the ellipsis indicates pack expansion. Naively, one would expect that the expansion would result in forms like

    alignas()
    alignas(1, 2)
    alignas(int, double)

but none of those forms is given any meaning by the current wording. Instead, 13.7.4 [temp.variadic] paragraph 4 says,

In an alignment-specifier (9.12.2 [dcl.align]); the pattern is the alignment-specifier without the ellipsis.

Presumably this means that something like alignas(T...) would expand to something like

    alignas(int) alignas(double)

This is counterintuitive and should be reexamined.

See also messages 24016 through 24021.

Notes from the February, 2014 meeting:

CWG decided to change the pack expansion of alignas so that the type-id or assignment-expression is repeated inside the parentheses and to change the definition of alignas to accept multiple arguments with the same meaning as multiple alignas specifiers.