1 // { dg-do compile } 2 // { dg-options "-O2 -Wstrict-aliasing" } 3 4 template<unsigned _Len, unsigned _Align> 5 struct aligned_storage 6 { 7 union type 8 { 9 unsigned char __data[_Len]; 10 struct __attribute__((__aligned__((_Align)))) { } __align; 11 }; 12 }; 13 14 aligned_storage<sizeof(int), __alignof__(int)>::type storage; 15 main()16int main() 17 { 18 *reinterpret_cast<int*>(&storage) = 42; // { dg-bogus "break strict-aliasing" } 19 } 20