Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
29 Views

typedef declaration with alignas issue in 15.0

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?

0 Kudos
1 Reply
Highlighted
Employee
29 Views

Hi,
I tried the following and g++ does issue a warning but implements it, while icc doesn't compile and looks like it's not implemented. I'll file this issue with the developers and will touch base with you as soon as I've an update.

Here's what I tried:
///

typedef int B alignas(32);
typedef int A alignas(16);
using A = int alignas(16);
using A alignas(16) = int;
//

And it does print out A and B like you mention, fyi.

_Regards,
Kittur 

0 Kudos