summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr25857.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/pr25857.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/pr25857.C18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/pr25857.C b/gcc/testsuite/g++.dg/opt/pr25857.C
new file mode 100644
index 000000000..4e6858fe1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr25857.C
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo();
+int i;
+
+struct A
+{
+ ~A() { if (this != (A*)(&i)) foo(); }
+};
+
+struct B
+{
+ A a1, a2, a3, a4;
+ ~B() { foo(); }
+};
+
+B b;