OSDN Git Service

gcc/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / warn / Wstrict-aliasing-bogus-base-derived.C
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
3
4
5 class base {
6  public:
7   int x;
8 };
9
10 class derived: public base {
11  public:
12   int y;
13 };
14
15 base foo () {
16   derived d;
17   base* pb = &d;  /* { dg-bogus "base vs. derived" } */
18   pb->x = 1;
19
20   return d;
21 }