1// { dg-do compile } 2// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> 3// DR152: explicit copy constructors 4 5namespace 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 18namespace 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} 37