Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/using6.C

raw
1 // { dg-do run }
2 // Test of class-scope using-declaration for functions.
3
4 #define assert(COND) if (!(COND)) return 1
5
6 struct A {
7 int f(int) { return 1; }
8 int f(char) { return 2; }
9 };
10
11 struct B {
12 int f(double) { return 3; }
13 };
14
15 struct C : public A, public B {
16 using A::f;
17 using B::f;
18 int f(char) { return 4; }
19 int f(C) { return 5; }
20 };
21
22 int main ()
23 {
24 C c;
25
26 assert (c.f(1) == 1);
27 assert (c.f('a') == 4);
28 assert (c.f(2.0) == 3);
29 assert (c.f(c) == 5);
30 }