------- Comment #2 from pinskia at gcc dot gnu dot org 2008-12-29 19:01 ------- If we swap around the MyStruct and the attribute, it works.
But if we do this: struct MyStruct1 { unsigned char skip[272]; } ; typedef struct MyStruct1 MyStruct __attribute__((aligned(128) )); template<typename T> int GetAlignOf() { int a[ __alignof__(T) != __alignof__(MyStruct) ? -1 : 1]; return __alignof__(T); }; int main() { int al1 = GetAlignOf<MyStruct>(); int al2 = __alignof__(MyStruct); return al1 - al2; } --- CUT --- It fails. Meaning we are still losing the user alignment for typedefs. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38611