Author: Richard Smith Date: 2020-03-13T18:53:49-07:00 New Revision: 44c3a63c74dddeef17e424ec76bd90c8582d8a3c
URL: https://github.com/llvm/llvm-project/commit/44c3a63c74dddeef17e424ec76bd90c8582d8a3c DIFF: https://github.com/llvm/llvm-project/commit/44c3a63c74dddeef17e424ec76bd90c8582d8a3c.diff LOG: PR45063: Fix crash on invalid processing an elaborated class template-id with an invalid scope specifier. Added: Modified: clang/lib/Sema/SemaTemplate.cpp clang/test/Parser/cxx-template-decl.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index f7568e3b62b7..4923d0a6dad2 100755 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -3814,6 +3814,9 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc) { + if (SS.isInvalid()) + return TypeResult(true); + TemplateName Template = TemplateD.get(); // Translate the parser's template argument list in our AST format. diff --git a/clang/test/Parser/cxx-template-decl.cpp b/clang/test/Parser/cxx-template-decl.cpp index cb8a93fdecb1..3d7a3dc14f4c 100644 --- a/clang/test/Parser/cxx-template-decl.cpp +++ b/clang/test/Parser/cxx-template-decl.cpp @@ -269,3 +269,7 @@ namespace AnnotateAfterInvalidTemplateId { void f() { A<0, 0>::f(); } // expected-error {{ambiguous partial specializations}} } + +namespace PR45063 { + template<class=class a::template b<>> struct X {}; // expected-error {{undeclared identifier 'a'}} +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits