From: Richard Smith Date: Mon, 23 Apr 2018 18:38:30 +0000 (+0000) Subject: DR727: remove wrong assertion for use of class-scope explicit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e307915dcfef53ec8e61aac35425eed0c893b5c8;p=clang DR727: remove wrong assertion for use of class-scope explicit specialization without -fms-extensions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330626 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 46f2f89d68..5f739fd550 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -7561,10 +7561,6 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, ClassTemplate->AddSpecialization(Specialization, InsertPos); if (CurContext->isDependentContext()) { - // -fms-extensions permits specialization of nested classes without - // fully specializing the outer class(es). - assert(getLangOpts().MicrosoftExt && - "Only possible with -fms-extensions!"); TemplateName CanonTemplate = Context.getCanonicalTemplateName(Name); CanonType = Context.getTemplateSpecializationType( CanonTemplate, Converted); diff --git a/test/CXX/drs/dr7xx.cpp b/test/CXX/drs/dr7xx.cpp index 982ffdddab..d02582b5b4 100644 --- a/test/CXX/drs/dr7xx.cpp +++ b/test/CXX/drs/dr7xx.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -namespace dr727 { // dr727: 7 +namespace dr727 { // dr727: partial struct A { template struct C; // expected-note 6{{here}} template void f(); // expected-note {{here}} @@ -48,6 +48,33 @@ namespace dr727 { // dr727: 7 template struct A::C; // expected-error {{not in class 'A' or an enclosing namespace}} template int A::N; // expected-error {{not in class 'A' or an enclosing namespace}} } + + template + struct D { + template struct C { typename T::error e; }; // expected-error {{no members}} + template void f() { T::error; } // expected-error {{no members}} + template static const int N = T::error; // expected-error 2{{no members}} expected-error 0-1{{C++14}} + + template<> struct C {}; + template<> void f() {} + template<> static const int N; + + template struct C {}; + template static const int N; + }; + + void d(D di) { + D::C(); + di.f(); + int a = D::N; // FIXME: expected-note {{instantiation of}} + + D::C(); + int b = D::N; + + D::C(); // expected-note {{instantiation of}} + di.f(); // expected-note {{instantiation of}} + int c = D::N; // expected-note {{instantiation of}} + } } namespace dr777 { // dr777: 3.7