blob: a635213b3a7d30248638ff3eefc638f17ea814f7 (
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
37
38
|
// { 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 "matching" "matching" }
// { dg-error "initializing" "initializing" { target *-*-* } 14 }
}
}
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 "matching" "matching" }
// { dg-error "initializing " initializing" { target *-*-* } 33 }
}
template int foo<float>(); // { dg-message "instantiated from here" }
}
|