aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/inherit/using2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/inherit/using2.C')
-rw-r--r--gcc/testsuite/g++.dg/inherit/using2.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/inherit/using2.C b/gcc/testsuite/g++.dg/inherit/using2.C
new file mode 100644
index 00000000000..19f06e9cc02
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/using2.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Sep 2002 <nathan@codesourcery.com>
+
+// PR 7919. Methods found via using decls didn't have their this
+// pointers converted to the final base type.
+
+struct Base {
+ int m;
+ protected:
+ void *Return () { return this; }
+};
+
+struct Derived : Base {
+ using Base::Return;
+ virtual ~Derived () {}
+};
+
+int main ()
+{
+ Derived d;
+
+ return static_cast <Base *> (&d) != d.Return ();
+}