blob: 1b6dd870d1890cd3c6e635bc148936f767041cf3 (
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
25
26
27
28
29
30
31
32
33
34
35
36
|
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR152: explicit copy constructors
namespace N1 {
struct X {
X();
explicit X(const X&);
};
void f(X);
int foo()
{
X x;
f(x); // { dg-error "" "" }
}
}
namespace N2 {
template <class T>
struct X {
X();
explicit X(const X&);
};
template <class T>
void f(T ) {}
template <class T>
int foo()
{
X<T> x;
N2::f(x); // { dg-error "" "" }
}
template int foo<float>(); // { dg-error "instantiated from here" }
}
|