aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union.C
blob: dfbb42c6fd5d2db1c9fed0c70da2db4b5c414bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* { dg-do compile } */
/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */


union U {
  int i;
  float f;
};

float foo () {
  union U u;
  float* f = &u.f;  /* { dg-bogus "unions are holy in GCC" } */
  u.i = 2;
  return *f;
}