The following code does not compile:
typedef int A alignas(16); // see 8.3 (1)
alignas(32) typedef int B; // see 8.3 (3)
According to the standard I think it should:
8.3 (1): The optional attribute-specifier-seq following a declarator-id appertains to the entity that is declared.
8.3 (3): ...a declaration of a particular identifier has the form T D where T is of the form attribute-specifier-seqopt decl-specifier-seq and D is a declarator.
Here "alignas()" is the attribute-specifier-seq, "typedef int" is the decl-specifier-seq and A and B are declarators.
Am I wrong?
I use MSVC2013 and the v120 base platform toolset.
On the other hand if I use the CTP_Nov2013 base platform toolset it does compile, but with the following warning: #3463: alignas does not apply here. Does this mean that your compiler does not support it yet? If so why not? Is there an undocumented compiler option to support it?
By the way, GCC 4.8 compiles both declarations and alignof(A) yields 16 and alignof(B) yields 32.
Who's right and who's wrong?