diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/lookup/using45.C')
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/using45.C | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lookup/using45.C b/gcc/testsuite/g++.dg/lookup/using45.C new file mode 100644 index 00000000000..c92b794d9c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using45.C @@ -0,0 +1,33 @@ +// PR c++/30195 +// { dg-do run } + +template <class T> +struct A +{ + int f(int) { return 0; } + int f(double) { return 1; } + int f(char) { return 2; } +}; + +template <class T> +struct B : A<T> +{ + using A<T>::f; + int f(int) { return 3; } +}; + +int main() +{ + B<int> b; + if( b.f( 42 ) != 3 ) + __builtin_abort(); + + if( b.f( 3.14 ) != 1 ) + __builtin_abort(); + + if( b.f( 'a' ) != 2 ) + __builtin_abort(); + + if( b.A<int>::f( 42 ) != 0 ) + __builtin_abort(); +} |