gcc/testsuite/g++.dg/cpp2a/bit-cast15.C
raw| 1 | // { dg-do compile } |
| 2 | |
| 3 | struct S { short a, b; }; |
| 4 | struct T { float a[4]; }; |
| 5 | struct U { int b[4]; }; |
| 6 | |
| 7 | #if __SIZEOF_FLOAT__ == __SIZEOF_INT__ |
| 8 | int |
| 9 | f1 (T &x) |
| 10 | { |
| 11 | return __builtin_bit_cast (U, x).b[1]; |
| 12 | } |
| 13 | |
| 14 | float |
| 15 | f2 (int (&x)[4]) |
| 16 | { |
| 17 | return __builtin_bit_cast (T, x).a[2]; |
| 18 | } |
| 19 | #endif |