summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/anon6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/anon6.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/anon6.C37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/anon6.C b/gcc/testsuite/g++.old-deja/g++.other/anon6.C
new file mode 100644
index 000000000..e1cfeb253
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/anon6.C
@@ -0,0 +1,37 @@
+// { dg-do run }
+extern "C" void abort ();
+
+struct A {
+ union {
+ int a;
+ double b;
+ int d;
+ };
+ int c;
+};
+
+struct B : public A {
+ union {
+ double a;
+ void *c;
+ };
+ float b;
+ int e;
+};
+
+int main ()
+{
+ struct B b;
+
+ b.a = 1.5;
+ b.b = 2.5;
+ b.d = 1;
+ b.e = 2;
+ if (b.a != 1.5 || b.b != 2.5 || b.d != 1 || b.e != 2)
+ abort ();
+ b.c = &b.a;
+ b.d = b.e;
+ if (b.c != &b.a || b.d != 2)
+ abort ();
+ return 0;
+}