Take: typedef struct MyStruct { unsigned char skip[272]; } 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 --- This should compile and execute without any errors and should return 0. -- Summary: [4.2/4.3/4.4 Regression] alignof is broken for user aligned types in templates Product: gcc Version: 4.3.3 Status: UNCONFIRMED Keywords: wrong-code Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38611