1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 struct X0
{ // expected-note{{candidate}}
3 X0(int); // expected-note{{candidate}}
4 template<typename T
> X0(T
); // expected-note {{candidate}}
5 template<typename T
, typename U
> X0(T
*, U
*); // expected-note {{candidate}}
8 template<typename T
> X0() : f0(T::foo
) {} // expected-note {{candidate}}
14 void test_X0(int i
, float f
) {
26 X0
x0g(f
, &i
); // expected-error{{no matching constructor}}
32 template<typename U
> X1(const X1
<U
>&);
41 explicit Outer(const A
& a
) : alloc(a
) { }
44 void test_X1(X1
<int> xi
) {
50 template<class C
> struct A
{};
51 template <> struct A
<int>{A(const A
<int>&);};
52 struct B
{ A
<int> x
; B(B
& a
) : x(a
.x
) {} };
55 X2(); // expected-note{{candidate constructor}}
56 X2(X2
&); // expected-note {{candidate constructor}}
57 template<typename T
> X2(T
);
60 X2
test(bool Cond
, X2 x2
) {
62 return x2
; // okay, uses copy constructor
64 return X2(); // expected-error{{no matching constructor}}
68 template<typename T
> X3(T
);
71 template<> X3::X3(X3
); // expected-error{{must pass its first argument by reference}}
77 template<typename T
> X4(const T
&, int = 17);
80 X4
test_X4(bool Cond
, X4 x4
) {
81 X4
a(x4
, 17); // okay, constructor template
82 X4
b(x4
); // okay, copy constructor
86 // Instantiation of a non-dependent use of a constructor
87 struct DefaultCtorHasDefaultArg
{
88 explicit DefaultCtorHasDefaultArg(int i
= 17);
92 void default_ctor_inst() {
93 DefaultCtorHasDefaultArg def
;
96 template void default_ctor_inst
<int>();
105 template<typename T
> X6(T
);
116 template<class T
> foo(T
&);