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