| 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(); // { dg-message "note" } |
| 8 |
explicit X(const X&); |
| 9 |
}; |
| 10 |
void f(X); // { dg-message "initializing" } |
| 11 |
int foo() |
| 12 |
{ |
| 13 |
X x; |
| 14 |
f(x); // { dg-error "matching" "matching" } |
| 15 |
return 0; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
namespace N2 { |
| 20 |
template <class T> |
| 21 |
struct X { |
| 22 |
X(); // { dg-message "note" } |
| 23 |
explicit X(const X&); |
| 24 |
}; |
| 25 |
|
| 26 |
template <class T> |
| 27 |
void f(T) {} // { dg-message "initializing" } |
| 28 |
|
| 29 |
template <class T> |
| 30 |
int foo() |
| 31 |
{ |
| 32 |
X<T> x; |
| 33 |
N2::f(x); // { dg-error "matching" "matching" } |
| 34 |
return 0; |
| 35 |
} |
| 36 |
|
| 37 |
template int foo<float>(); // { dg-message "required from here" } |
| 38 |
} |