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 ListList15 List() : prev(&node) { xyz(); } 16 17 void xyz(); 18 backList19 int back() { return static_cast<Node*>(prev)->data; } 20 }; 21 22 struct A 23 { 24 virtual ~A(); 25 }; 26 27 A* foo(); 28 bar()29void bar() 30 { 31 List y; 32 if (y.back()) 33 delete foo(); 34 } 35 36