Douglas Gregor | dec0666 | 2009-08-21 18:42:58 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | struct 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 Gregor | efd5bda | 2009-08-24 11:57:43 +0000 | [diff] [blame] | 7 | |
| 8 | // PR4761 |
| 9 | template<typename T> X0() : f0(T::foo) {} |
| 10 | int f0; |
Douglas Gregor | dec0666 | 2009-08-21 18:42:58 +0000 | [diff] [blame] | 11 | }; |
| 12 | |
| 13 | void accept_X0(X0); |
| 14 | |
| 15 | void 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 Gregor | f882574 | 2009-09-15 18:26:13 +0000 | [diff] [blame] | 29 | |
| 30 | template<typename T> |
| 31 | struct X1 { |
| 32 | X1(const X1&); |
| 33 | template<typename U> X1(const X1<U>&); |
| 34 | }; |
| 35 | |
| 36 | template<typename T> |
| 37 | struct Outer { |
| 38 | typedef X1<T> A; |
| 39 | |
| 40 | A alloc; |
| 41 | |
| 42 | explicit Outer(const A& a) : alloc(a) { } |
| 43 | }; |
| 44 | |
| 45 | void test_X1(X1<int> xi) { |
| 46 | Outer<int> oi(xi); |
| 47 | Outer<float> of(xi); |
| 48 | } |
Douglas Gregor | c7e406b | 2009-09-15 21:14:05 +0000 | [diff] [blame] | 49 | |
| 50 | // PR4655 |
| 51 | template<class C> struct A {}; |
| 52 | template <> struct A<int>{A(const A<int>&);}; |
| 53 | struct B { A<int> x; B(B& a) : x(a.x) {} }; |
Douglas Gregor | 3f9a056 | 2009-11-03 01:35:08 +0000 | [diff] [blame] | 54 | |