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