summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/oper1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/ext/oper1.C')
-rw-r--r--gcc/testsuite/g++.dg/ext/oper1.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/oper1.C b/gcc/testsuite/g++.dg/ext/oper1.C
new file mode 100644
index 000000000..7f97d73a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/oper1.C
@@ -0,0 +1,19 @@
+// { dg-do run }
+
+// Copyright 2002 Free Software Foundation
+// Contributed by Jason Merrill <jason@redhat.com>
+
+// Make sure the GNU extension of accepting dropping cv-qualifiers for
+// the implicit this argument does not kick in when taking the address
+// of an object, since this extension would change the meaning of a
+// well-defined program.
+
+struct A {
+ A* operator&() { return 0; }
+};
+
+int main ()
+{
+ const A a = {};
+ return (&a == 0);
+}