view gcc/testsuite/g++.dg/lookup/using45.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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();
}