The result of alignof(T) is computed using ASTContext::getPreferredTypeAlign, 
which for certain types may return an alignment that is greater than the one 
computed by getTypeAlign. This patch teaches getPreferredTypeAlign not to 
change alignments specified with an aligned attribute on a typedef and thus 
allows the following test to compile:

typedef long long T __attribute__((aligned(1));
static_assert(alignof(T) == 1, "");

This patch does not affect the new test in CodeGen/alignment.c, but given the 
special handling of long long in getPreferredTypeAlign I thought it might be 
prudent to add a check for long long typedefs with an aligned attribute to the 
existing test for int typedefs.

- Stephan

Attachment: getPreferredTypeAlign.patch
Description: getPreferredTypeAlign.patch

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to