1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify -std=c++11 %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc template <class T> 4*f4a2713aSLionel Sambuc class A { 5*f4a2713aSLionel Sambuc void foo() { 6*f4a2713aSLionel Sambuc undeclared(); 7*f4a2713aSLionel Sambuc } 8*f4a2713aSLionel Sambuc void foo2(); 9*f4a2713aSLionel Sambuc }; 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc template <class T> 12*f4a2713aSLionel Sambuc class B { 13*f4a2713aSLionel Sambuc void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}} 14*f4a2713aSLionel Sambuc void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} 15*f4a2713aSLionel Sambuc void foo5() { } // expected-note {{previous definition is here}} 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc friend void foo3() { 18*f4a2713aSLionel Sambuc undeclared(); 19*f4a2713aSLionel Sambuc } 20*f4a2713aSLionel Sambuc }; 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc template <class T> 24*f4a2713aSLionel Sambuc void B<T>::foo5() { // expected-error {{redefinition of 'foo5'}} 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc template <class T> 28*f4a2713aSLionel Sambuc void A<T>::foo2() { 29*f4a2713aSLionel Sambuc undeclared(); 30*f4a2713aSLionel Sambuc } 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc template <class T> 34*f4a2713aSLionel Sambuc void foo3() { 35*f4a2713aSLionel Sambuc undeclared(); 36*f4a2713aSLionel Sambuc } 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc template void A<int>::foo2(); 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc void undeclared() 42*f4a2713aSLionel Sambuc { 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc } 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc template <class T> void foo5() {} //expected-note {{previous definition is here}} 47*f4a2713aSLionel Sambuc template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}} 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc 51*f4a2713aSLionel Sambuc namespace Inner_Outer_same_template_param_name { 52*f4a2713aSLionel Sambuc 53*f4a2713aSLionel Sambuc template <class T> 54*f4a2713aSLionel Sambuc class Outmost { 55*f4a2713aSLionel Sambuc public: 56*f4a2713aSLionel Sambuc template <class T> 57*f4a2713aSLionel Sambuc class Inner { 58*f4a2713aSLionel Sambuc public: 59*f4a2713aSLionel Sambuc void f() { 60*f4a2713aSLionel Sambuc T* var; 61*f4a2713aSLionel Sambuc } 62*f4a2713aSLionel Sambuc }; 63*f4a2713aSLionel Sambuc }; 64*f4a2713aSLionel Sambuc 65*f4a2713aSLionel Sambuc } 66*f4a2713aSLionel Sambuc 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc namespace PR11931 { 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc template <typename RunType> 71*f4a2713aSLionel Sambuc struct BindState; 72*f4a2713aSLionel Sambuc 73*f4a2713aSLionel Sambuc template<> 74*f4a2713aSLionel Sambuc struct BindState<void(void*)> { 75*f4a2713aSLionel Sambuc static void Run() { } 76*f4a2713aSLionel Sambuc }; 77*f4a2713aSLionel Sambuc 78*f4a2713aSLionel Sambuc class Callback { 79*f4a2713aSLionel Sambuc public: 80*f4a2713aSLionel Sambuc typedef void RunType(); 81*f4a2713aSLionel Sambuc 82*f4a2713aSLionel Sambuc template <typename RunType> 83*f4a2713aSLionel Sambuc Callback(BindState<RunType> bind_state) { 84*f4a2713aSLionel Sambuc BindState<RunType>::Run(); 85*f4a2713aSLionel Sambuc } 86*f4a2713aSLionel Sambuc }; 87*f4a2713aSLionel Sambuc 88*f4a2713aSLionel Sambuc 89*f4a2713aSLionel Sambuc Callback Bind() { 90*f4a2713aSLionel Sambuc return Callback(BindState<void(void*)>()); 91*f4a2713aSLionel Sambuc } 92*f4a2713aSLionel Sambuc 93*f4a2713aSLionel Sambuc } 94*f4a2713aSLionel Sambuc 95*f4a2713aSLionel Sambuc namespace rdar11700604 { 96*f4a2713aSLionel Sambuc template<typename T> void foo() = delete; 97*f4a2713aSLionel Sambuc 98*f4a2713aSLionel Sambuc struct X { 99*f4a2713aSLionel Sambuc X() = default; 100*f4a2713aSLionel Sambuc 101*f4a2713aSLionel Sambuc template<typename T> void foo() = delete; 102*f4a2713aSLionel Sambuc }; 103*f4a2713aSLionel Sambuc } 104*f4a2713aSLionel Sambuc 105*f4a2713aSLionel Sambuc namespace PR17334 { 106*f4a2713aSLionel Sambuc 107*f4a2713aSLionel Sambuc template <typename = void> struct ArrayRef { 108*f4a2713aSLionel Sambuc constexpr ArrayRef() {} 109*f4a2713aSLionel Sambuc }; 110*f4a2713aSLionel Sambuc template <typename = void> void CreateConstInBoundsGEP2_32() { 111*f4a2713aSLionel Sambuc ArrayRef<> IdxList; 112*f4a2713aSLionel Sambuc } 113*f4a2713aSLionel Sambuc void LLVMBuildStructGEP() { CreateConstInBoundsGEP2_32(); } 114*f4a2713aSLionel Sambuc 115*f4a2713aSLionel Sambuc } 116*f4a2713aSLionel Sambuc 117*f4a2713aSLionel Sambuc namespace PR17661 { 118*f4a2713aSLionel Sambuc template <typename T> 119*f4a2713aSLionel Sambuc constexpr T Fun(T A) { return T(0); } 120*f4a2713aSLionel Sambuc 121*f4a2713aSLionel Sambuc constexpr int Var = Fun(20); 122*f4a2713aSLionel Sambuc } 123*f4a2713aSLionel Sambuc 124