summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/using6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/using6.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/using6.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/using6.C b/gcc/testsuite/g++.old-deja/g++.other/using6.C
new file mode 100644
index 000000000..272c35dff
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/using6.C
@@ -0,0 +1,30 @@
+// { dg-do run }
+// Test of class-scope using-declaration for functions.
+
+#define assert(COND) if (!(COND)) return 1
+
+struct A {
+ int f(int) { return 1; }
+ int f(char) { return 2; }
+};
+
+struct B {
+ int f(double) { return 3; }
+};
+
+struct C : public A, public B {
+ using A::f;
+ using B::f;
+ int f(char) { return 4; }
+ int f(C) { return 5; }
+};
+
+int main ()
+{
+ C c;
+
+ assert (c.f(1) == 1);
+ assert (c.f('a') == 4);
+ assert (c.f(2.0) == 3);
+ assert (c.f(c) == 5);
+}