blob: acd845bc2fd58e90ac71285a3c62eb401aad9c1e [file] [log] [blame]
Douglas Gregor050cabf2009-08-21 18:42:58 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3struct X0 { // expected-note{{candidate}}
4 X0(int); // expected-note{{candidate}}
5 template<typename T> X0(T);
6 template<typename T, typename U> X0(T*, U*);
Douglas Gregor84164f02009-08-24 11:57:43 +00007
8 // PR4761
9 template<typename T> X0() : f0(T::foo) {}
10 int f0;
Douglas Gregor050cabf2009-08-21 18:42:58 +000011};
12
13void accept_X0(X0);
14
15void test_X0(int i, float f) {
16 X0 x0a(i);
17 X0 x0b(f);
18 X0 x0c = i;
19 X0 x0d = f;
20 accept_X0(i);
21 accept_X0(&i);
22 accept_X0(f);
23 accept_X0(&f);
24 X0 x0e(&i, &f);
25 X0 x0f(&f, &i);
26
27 X0 x0g(f, &i); // expected-error{{no matching constructor}}
28}
Douglas Gregor088fc242009-09-15 18:26:13 +000029
30template<typename T>
31struct X1 {
32 X1(const X1&);
33 template<typename U> X1(const X1<U>&);
34};
35
36template<typename T>
37struct Outer {
38 typedef X1<T> A;
39
40 A alloc;
41
42 explicit Outer(const A& a) : alloc(a) { }
43};
44
45void test_X1(X1<int> xi) {
46 Outer<int> oi(xi);
47 Outer<float> of(xi);
48}
Douglas Gregor4ec1aca2009-09-15 21:14:05 +000049
50// PR4655
51template<class C> struct A {};
52template <> struct A<int>{A(const A<int>&);};
53struct B { A<int> x; B(B& a) : x(a.x) {} };