r227540 - Weaken an assertion that isn't true for invalid input.

Nico Weber nicolasweber at gmx.de
Thu Jan 29 17:48:49 PST 2015


Author: nico
Date: Thu Jan 29 19:48:49 2015
New Revision: 227540

URL: http://llvm.org/viewvc/llvm-project?rev=227540&view=rev
Log:
Weaken an assertion that isn't true for invalid input.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaTemplate/dependent-names.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=227540&r1=227539&r2=227540&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jan 29 19:48:49 2015
@@ -5578,8 +5578,9 @@ Sema::ActOnVariableDeclarator(Scope *S,
         }
       }
     } else {
-      assert(D.getName().getKind() != UnqualifiedId::IK_TemplateId &&
-             "should have a 'template<>' for this decl");
+      assert(
+          (Invalid || D.getName().getKind() != UnqualifiedId::IK_TemplateId) &&
+          "should have a 'template<>' for this decl");
     }
 
     if (IsVariableTemplateSpecialization) {

Modified: cfe/trunk/test/SemaTemplate/dependent-names.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-names.cpp?rev=227540&r1=227539&r2=227540&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-names.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-names.cpp Thu Jan 29 19:48:49 2015
@@ -414,3 +414,8 @@ namespace PR19936 {
   template<typename T> decltype(*T()) f() {} // expected-error {{redefinition}}
   template<typename T> decltype(T() * T()) g() {} // expected-error {{redefinition}}
 }
+
+template <typename> struct CT2 {
+  template <class U> struct X;
+};
+template <typename T> int CT2<int>::X<>; // expected-error {{template parameter list matching the non-templated nested type 'CT2<int>' should be empty}}





More information about the cfe-commits mailing list