summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/access19.C
blob: 6420b1cbed1f2848c287ea77a5c3d96abd2a972a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* PR c++/29475 The error diagnostic contained "U = U" instead of "U = char" */
/* { dg-do compile } */

template< class T >
class explicit_t
{
public:
        explicit_t( const T& c ): value( c ) { }
        operator T&() { return value; }
private:
        template< class U >
        explicit_t( U t ); /* { dg-error "with U = char, T = int|is private" } */
        T value;
};

int foo( int x, explicit_t< int > y )
{
        return x + y;
}

int main()
{
        return foo( 5, 'c' ); /* { dg-error "this context" } */
}