1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fms-extensions -fsyntax-only -verify %s -Wno-microsoft 2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s -Wno-microsoft 3*0a6a1f1dSLionel Sambuc 4*0a6a1f1dSLionel Sambuc class A { 5*0a6a1f1dSLionel Sambuc public: 6*0a6a1f1dSLionel Sambuc template<typename T> struct X { typedef int x; }; 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc X<int>::x a; // expected-note {{implicit instantiation first required here}} 9*0a6a1f1dSLionel Sambuc 10*0a6a1f1dSLionel Sambuc template<> struct X<int>; // expected-error {{explicit specialization of 'A::X<int>' after instantiation}} 11*0a6a1f1dSLionel Sambuc template<> struct X<char>; // expected-note {{forward declaration}} 12*0a6a1f1dSLionel Sambuc 13*0a6a1f1dSLionel Sambuc X<char>::x b; // expected-error {{incomplete type 'A::X<char>' named in nested name specifier}} 14*0a6a1f1dSLionel Sambuc 15*0a6a1f1dSLionel Sambuc template<> struct X<double> { 16*0a6a1f1dSLionel Sambuc typedef int y; 17*0a6a1f1dSLionel Sambuc }; 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel Sambuc X<double>::y c; 20*0a6a1f1dSLionel Sambuc 21*0a6a1f1dSLionel Sambuc template<> struct X<float> {}; // expected-note {{previous definition is here}} 22*0a6a1f1dSLionel Sambuc template<> struct X<float> {}; // expected-error {{redefinition of 'A::X<float>'}} 23*0a6a1f1dSLionel Sambuc }; 24*0a6a1f1dSLionel Sambuc 25*0a6a1f1dSLionel Sambuc A::X<void>::x axv; 26*0a6a1f1dSLionel Sambuc A::X<float>::x axf; // expected-error {{no type named 'x'}} 27*0a6a1f1dSLionel Sambuc 28*0a6a1f1dSLionel Sambuc template<class T> class B { 29*0a6a1f1dSLionel Sambuc public: 30*0a6a1f1dSLionel Sambuc template<typename U> struct X { typedef int x; }; 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuc typename X<int>::x a; // expected-note {{implicit instantiation first required here}} 33*0a6a1f1dSLionel Sambuc 34*0a6a1f1dSLionel Sambuc template<> struct X<int>; // expected-error {{explicit specialization of 'X<int>' after instantiation}} 35*0a6a1f1dSLionel Sambuc template<> struct X<char>; // expected-note {{forward declaration}} 36*0a6a1f1dSLionel Sambuc 37*0a6a1f1dSLionel Sambuc typename X<char>::x b; // expected-error {{incomplete type 'B<float>::X<char>' named in nested name specifier}} 38*0a6a1f1dSLionel Sambuc 39*0a6a1f1dSLionel Sambuc template<> struct X<double> { 40*0a6a1f1dSLionel Sambuc typedef int y; 41*0a6a1f1dSLionel Sambuc }; 42*0a6a1f1dSLionel Sambuc 43*0a6a1f1dSLionel Sambuc typename X<double>::y c; 44*0a6a1f1dSLionel Sambuc 45*0a6a1f1dSLionel Sambuc template<> struct X<float> {}; // expected-note {{previous definition is here}} 46*0a6a1f1dSLionel Sambuc template<> struct X<T> {}; // expected-error {{redefinition of 'X<float>'}} 47*0a6a1f1dSLionel Sambuc }; 48*0a6a1f1dSLionel Sambuc 49*0a6a1f1dSLionel Sambuc B<float> b; // expected-note {{in instantiation of}} 50