From 6ef07019e1295416304a18633c27f5aaa4bafb76 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 30 Jan 2015 01:48:49 +0000 Subject: [PATCH] Weaken an assertion that isn't true for invalid input. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227540 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 5 +++-- test/SemaTemplate/dependent-names.cpp | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index cd6ff6ce58..eb21dff766 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5578,8 +5578,9 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } } 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) { diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index 011e073a72..d5c9d66c45 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -414,3 +414,8 @@ namespace PR19936 { template decltype(*T()) f() {} // expected-error {{redefinition}} template decltype(T() * T()) g() {} // expected-error {{redefinition}} } + +template struct CT2 { + template struct X; +}; +template int CT2::X<>; // expected-error {{template parameter list matching the non-templated nested type 'CT2' should be empty}} -- 2.40.0