summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/field2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/field2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/field2.C21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/field2.C b/gcc/testsuite/g++.old-deja/g++.other/field2.C
new file mode 100644
index 000000000..5dd1e97fb
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/field2.C
@@ -0,0 +1,21 @@
+// { dg-do run }
+// Test for proper handling of field calls.
+// Contributed by Jason Merrill <jason@cygnus.com>
+
+struct A {
+ inline A* operator()() { return this; }
+};
+
+struct B {
+ int i;
+ union { A a; };
+};
+
+int
+main ()
+{
+ B b;
+ A* ap = &b.a;
+ A* ap2 = b.a();
+ return (ap != ap2);
+}