1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2f4a2713aSLionel Sambuc // expected-no-diagnostics 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc // PR5426 - the non-dependent obj would be fully processed and wrapped in a 5f4a2713aSLionel Sambuc // CXXConstructExpr at definition time, which would lead to a failure at 6f4a2713aSLionel Sambuc // instantiation time. 7f4a2713aSLionel Sambuc struct arg { 8f4a2713aSLionel Sambuc arg(); 9f4a2713aSLionel Sambuc }; 10f4a2713aSLionel Sambuc 11f4a2713aSLionel Sambuc struct oldstylemove { 12f4a2713aSLionel Sambuc oldstylemove(oldstylemove&); 13f4a2713aSLionel Sambuc oldstylemove(const arg&); 14f4a2713aSLionel Sambuc }; 15f4a2713aSLionel Sambuc 16f4a2713aSLionel Sambuc template <typename T> fn(T t,const arg & arg)17f4a2713aSLionel Sambucvoid fn(T t, const arg& arg) { 18f4a2713aSLionel Sambuc oldstylemove obj(arg); 19f4a2713aSLionel Sambuc } 20f4a2713aSLionel Sambuc test()21f4a2713aSLionel Sambucvoid test() { 22f4a2713aSLionel Sambuc fn(1, arg()); 23f4a2713aSLionel Sambuc } 24f4a2713aSLionel Sambuc 25f4a2713aSLionel Sambuc struct X0 { }; 26f4a2713aSLionel Sambuc 27f4a2713aSLionel Sambuc struct X1 { 28f4a2713aSLionel Sambuc explicit X1(const X0 &x0 = X0()); 29f4a2713aSLionel Sambuc }; 30f4a2713aSLionel Sambuc 31f4a2713aSLionel Sambuc template<typename T> f0()32f4a2713aSLionel Sambucvoid f0() { 33f4a2713aSLionel Sambuc X1 x1; 34f4a2713aSLionel Sambuc } 35f4a2713aSLionel Sambuc 36f4a2713aSLionel Sambuc template void f0<int>(); 37f4a2713aSLionel Sambuc template void f0<float>(); 38f4a2713aSLionel Sambuc 39f4a2713aSLionel Sambuc struct NonTrivial { 40f4a2713aSLionel Sambuc NonTrivial(); 41f4a2713aSLionel Sambuc ~NonTrivial(); 42f4a2713aSLionel Sambuc }; 43f4a2713aSLionel Sambuc f1()44f4a2713aSLionel Sambuctemplate<int N> void f1() { 45f4a2713aSLionel Sambuc NonTrivial array[N]; 46f4a2713aSLionel Sambuc } 47f4a2713aSLionel Sambuc template<> void f1<2>(); 48*0a6a1f1dSLionel Sambuc 49*0a6a1f1dSLionel Sambuc namespace PR20346 { 50*0a6a1f1dSLionel Sambuc struct S { short inner_s; }; 51*0a6a1f1dSLionel Sambuc 52*0a6a1f1dSLionel Sambuc struct outer_struct { 53*0a6a1f1dSLionel Sambuc wchar_t arr[32]; 54*0a6a1f1dSLionel Sambuc S outer_s; 55*0a6a1f1dSLionel Sambuc }; 56*0a6a1f1dSLionel Sambuc 57*0a6a1f1dSLionel Sambuc template <class T> OpenFileSession()58*0a6a1f1dSLionel Sambuc void OpenFileSession() { 59*0a6a1f1dSLionel Sambuc // Ensure that we don't think the ImplicitValueInitExpr generated here 60*0a6a1f1dSLionel Sambuc // during the initial parse only initializes the first array element! 61*0a6a1f1dSLionel Sambuc outer_struct asdfasdf = {}; 62*0a6a1f1dSLionel Sambuc }; 63*0a6a1f1dSLionel Sambuc foo()64*0a6a1f1dSLionel Sambuc void foo() { 65*0a6a1f1dSLionel Sambuc OpenFileSession<int>(); 66*0a6a1f1dSLionel Sambuc } 67*0a6a1f1dSLionel Sambuc } 68