OSDN Git Service

1b6dd870d1890cd3c6e635bc148936f767041cf3
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / tc1 / dr152.C
1 // { dg-do compile }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR152: explicit copy constructors 
4
5 namespace N1 {
6   struct X {
7     X();
8     explicit X(const X&);
9   };
10   void f(X);
11   int foo() 
12   { 
13     X x; 
14     f(x);     // { dg-error "" "" }
15   }
16 }
17
18 namespace N2 {
19   template <class T>
20   struct X {
21     X();
22     explicit X(const X&);
23   };
24
25   template <class T>
26   void f(T ) {}
27   
28   template <class T>
29   int foo() 
30   { 
31     X<T> x; 
32     N2::f(x);   // { dg-error "" "" }
33   }
34
35   template int foo<float>();  // { dg-error "instantiated from here" }
36 }