view gcc/testsuite/g++.dg/lookup/using45.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +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();
}