1 // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s 2 3 template <class T> 4 class A { 5 void foo() { 6 undeclared(); 7 } 8 void foo2(); 9 }; 10 11 template <class T> 12 class B { 13 void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}} 14 void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}} 15 16 friend void foo3() { 17 undeclared(); 18 } 19 }; 20 21 22 template <class T> 23 void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}} 24 } 25 26 template <class T> 27 void A<T>::foo2() { 28 undeclared(); 29 } 30 31 32 template <class T> 33 void foo3() { 34 undeclared(); 35 } 36 37 template void A<int>::foo2(); 38 39 40 void undeclared() 41 { 42 43 } 44 45 template <class T> void foo5() {} //expected-note {{previous definition is here}} 46 template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}} 47 48 49 50 namespace Inner_Outer_same_template_param_name { 51 52 template <class T> 53 class Outmost { 54 public: 55 template <class T> 56 class Inner { 57 public: 58 void f() { 59 T* var; 60 } 61 }; 62 }; 63 64 } 65 66 67 namespace PR11931 { 68 69 template <typename RunType> 70 struct BindState; 71 72 template<> 73 struct BindState<void(void*)> { 74 static void Run() { } 75 }; 76 77 class Callback { 78 public: 79 typedef void RunType(); 80 81 template <typename RunType> 82 Callback(BindState<RunType> bind_state) { 83 BindState<RunType>::Run(); 84 } 85 }; 86 87 88 Callback Bind() { 89 return Callback(BindState<void(void*)>()); 90 } 91 92 } 93