Debian Codegraph @

gcc/testsuite/g++.dg/lookup/using45.C

raw
1 // PR c++/30195
2 // { dg-do run }
3
4 template <class T>
5 struct A
6 {
7 int f(int) { return 0; }
8 int f(double) { return 1; }
9 int f(char) { return 2; }
10 };
11
12 template <class T>
13 struct B : A<T>
14 {
15 using A<T>::f;
16 int f(int) { return 3; }
17 };
18
19 int main()
20 {
21 B<int> b;
22 if( b.f( 42 ) != 3 )
23 __builtin_abort();
24
25 if( b.f( 3.14 ) != 1 )
26 __builtin_abort();
27
28 if( b.f( 'a' ) != 2 )
29 __builtin_abort();
30
31 if( b.A<int>::f( 42 ) != 0 )
32 __builtin_abort();
33 }