aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/bit-cast15.C
blob: 5326af0503dd705cdc9a81cffb69328d6f527b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// { dg-do compile }

struct S { short a, b; };
struct T { float a[4]; };
struct U { int b[4]; };

#if __SIZEOF_FLOAT__ == __SIZEOF_INT__
int
f1 (T &x)
{
  return __builtin_bit_cast (U, x).b[1];
}

float
f2 (int (&x)[4])
{
  return __builtin_bit_cast (T, x).a[2];
}
#endif