Title
alignas pack expansion syntax
Status
drafting
Section
9.12.1 [dcl.attr.grammar]
Submitter
Daveed Vandevoorde

Created on 2013-06-26.00:00:00 last changed 123 months ago

Messages

Date: 2014-02-15.00:00:00

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.

Date: 2013-10-14.00:00:00

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

    alignment-specifier:
      alignas ( type-id ...opt)
      alignas ( assignment-expression ...opt)

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.

History
Date User Action Args
2014-03-03 00:00:00adminsetmessages: + msg4882
2014-03-03 00:00:00adminsetstatus: open -> drafting
2013-06-26 00:00:00admincreate