// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct X0 { // expected-note 8{{candidate}} X0(int*, float*); // expected-note 4{{candidate}} }; template X0 f0(T t, U u) { X0 x0(t, u); // expected-error{{no matching}} return X0(t, u); // expected-error{{no matching}} } void test_f0(int *ip, float *fp, double *dp) { f0(ip, fp); f0(ip, dp); // expected-note{{instantiation}} } template Ret f1(Ret *retty, T t, U u) { Ret r0(t, u); // expected-error{{no matching}} return Ret(t, u); // expected-error{{no matching}} } void test_f1(X0 *x0, int *ip, float *fp, double *dp) { f1(x0, ip, fp); f1(x0, ip, dp); // expected-note{{instantiation}} } namespace PR6457 { template struct X { explicit X(T* p = 0) { }; }; template struct Y { Y(int, const T& x); }; struct A { }; template struct B { B() : y(0, X()) { } Y > y; }; B b; } namespace PR6657 { struct X { X (int, int) { } }; template void f0() { X x = X(0, 0); } void f1() { f0(); } } // Instantiate out-of-line definitions of static data members which complete // types through an initializer even when the only use of the member that would // cause instantiation is in an unevaluated context, but one requiring its // complete type. namespace PR10001 { template struct S { static const int arr[]; static const int x; static int f(); }; template const int S::arr[] = { 1, 2, 3 }; template const int S::x = sizeof(arr) / sizeof(arr[0]); template int S::f() { return x; } int x = S::f(); } namespace PR7985 { template struct integral_c { }; template integral_c array_lengthof(T (&x)[N]) { return integral_c(); } // expected-note 2{{candidate template ignored: could not match 'T [N]' against 'const Data<}} template struct Data { T x; }; template struct Description { static const Data data[]; }; template const Data Description::data[] = {{ 1 }}; // expected-error{{cannot initialize a member subobject of type 'int *' with an rvalue of type 'int'}} template<> const Data Description::data[]; void test() { integral_c<1> ic1 = array_lengthof(Description::data); (void)sizeof(array_lengthof(Description::data)); sizeof(array_lengthof( // expected-error{{no matching function for call to 'array_lengthof'}} Description::data // expected-note{{in instantiation of static data member 'PR7985::Description::data' requested here}} )); array_lengthof(Description::data); // expected-error{{no matching function for call to 'array_lengthof'}} } } namespace PR13064 { // Ensure that in-class direct-initialization is instantiated as // direct-initialization and likewise copy-initialization is instantiated as // copy-initialization. struct A { explicit A(int); }; // expected-note{{here}} template struct B { T a { 0 }; }; B b; template struct C { T a = { 0 }; }; // expected-error{{explicit}} C c; // expected-note{{here}} } namespace PR16903 { // Make sure we properly instantiate list-initialization. template void fun (T it) { int m = 0; for (int i = 0; i < 4; ++i, ++it){ m |= long{char{*it}}; } } int test() { char in[4] = {0,0,0,0}; fun(in); } }