r330626 - DR727: remove wrong assertion for use of class-scope explicit

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 23 11:38:30 PDT 2018


Author: rsmith
Date: Mon Apr 23 11:38:30 2018
New Revision: 330626

URL: http://llvm.org/viewvc/llvm-project?rev=330626&view=rev
Log:
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/CXX/drs/dr7xx.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=330626&r1=330625&r2=330626&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Apr 23 11:38:30 2018
@@ -7561,10 +7561,6 @@ Sema::ActOnClassTemplateSpecialization(S
       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);

Modified: cfe/trunk/test/CXX/drs/dr7xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr7xx.cpp?rev=330626&r1=330625&r2=330626&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr7xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr7xx.cpp Mon Apr 23 11:38:30 2018
@@ -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<typename T> struct C; // expected-note 6{{here}}
     template<typename T> void f(); // expected-note {{here}}
@@ -48,6 +48,33 @@ namespace dr727 { // dr727: 7
     template<typename T> struct A::C<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}}
     template<typename T> int A::N<T*****>; // expected-error {{not in class 'A' or an enclosing namespace}}
   }
+
+  template<typename>
+  struct D {
+    template<typename T> struct C { typename T::error e; }; // expected-error {{no members}}
+    template<typename T> void f() { T::error; } // expected-error {{no members}}
+    template<typename T> static const int N = T::error; // expected-error 2{{no members}} expected-error 0-1{{C++14}}
+
+    template<> struct C<int> {};
+    template<> void f<int>() {}
+    template<> static const int N<int>;
+
+    template<typename T> struct C<T*> {};
+    template<typename T> static const int N<T*>;
+  };
+
+  void d(D<int> di) {
+    D<int>::C<int>();
+    di.f<int>();
+    int a = D<int>::N<int>; // FIXME: expected-note {{instantiation of}}
+
+    D<int>::C<int*>();
+    int b = D<int>::N<int*>;
+
+    D<int>::C<float>(); // expected-note {{instantiation of}}
+    di.f<float>(); // expected-note {{instantiation of}}
+    int c = D<int>::N<float>; // expected-note {{instantiation of}}
+  }
 }
 
 namespace dr777 { // dr777: 3.7




More information about the cfe-commits mailing list