Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/bit-cast1.C

raw
1 // { dg-do compile }
2
3 struct S { short a, b; };
4 struct T { float a[16]; };
5 struct U { int b[16]; };
6
7 #if __SIZEOF_FLOAT__ == __SIZEOF_INT__
8 int
9 f1 (float x)
10 {
11 return __builtin_bit_cast (int, x);
12 }
13 #endif
14
15 #if 2 * __SIZEOF_SHORT__ == __SIZEOF_INT__
16 S
17 f2 (int x)
18 {
19 return __builtin_bit_cast (S, x);
20 }
21
22 int
23 f3 (S x)
24 {
25 return __builtin_bit_cast (int, x);
26 }
27 #endif
28
29 #if __SIZEOF_FLOAT__ == __SIZEOF_INT__
30 U
31 f4 (T &x)
32 {
33 return __builtin_bit_cast (U, x);
34 }
35
36 T
37 f5 (int (&x)[16])
38 {
39 return __builtin_bit_cast (T, x);
40 }
41 #endif
42
43 int
44 f6 ()
45 {
46 return __builtin_bit_cast (unsigned char, (signed char) 0);
47 }