Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-char-2.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 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 | |
16 int main() | |
17 { | |
18 *reinterpret_cast<int*>(&storage) = 42; // { dg-bogus "break strict-aliasing" } | |
19 } |