OSDN Git Service

cp/:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / warn / Wstrict-aliasing-bogus-escape-3.C
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-aliasing" } */
3
4 struct Node_base {};
5
6 struct Node : Node_base
7 {
8   int data;
9 };
10
11 struct List
12 {
13   Node_base node, *prev;
14
15   List() : prev(&node) { xyz(); }
16
17   void xyz();
18
19   int back() { return static_cast<Node*>(prev)->data; }
20 };
21
22 struct A
23 {
24   virtual ~A();
25 };
26
27 A* foo();
28
29 void bar()
30 {
31   List y;
32   if (y.back())
33     delete foo();
34 }
35