1/* { dg-do compile } */ 2/* { dg-options "-O2 -Wstrict-aliasing" } */ 3 4struct Node_base {}; 5 6struct Node : Node_base 7{ 8 int data; 9}; 10 11struct 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 22struct A 23{ 24 virtual ~A(); 25}; 26 27A* foo(); 28 29void bar() 30{ 31 List y; 32 if (y.back()) 33 delete foo(); 34} 35 36