Skip to content

Commit d942a81

Browse files
zygoloidhokein
authored andcommitted
PR45063: Fix crash on invalid processing an elaborated class template-id
with an invalid scope specifier. (cherry picked from commit 44c3a63)
1 parent cbc9b92 commit d942a81

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3817,6 +3817,9 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
38173817
SourceLocation LAngleLoc,
38183818
ASTTemplateArgsPtr TemplateArgsIn,
38193819
SourceLocation RAngleLoc) {
3820+
if (SS.isInvalid())
3821+
return TypeResult(true);
3822+
38203823
TemplateName Template = TemplateD.get();
38213824

38223825
// Translate the parser's template argument list in our AST format.

clang/test/Parser/cxx-template-decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,7 @@ namespace AnnotateAfterInvalidTemplateId {
269269

270270
void f() { A<0, 0>::f(); } // expected-error {{ambiguous partial specializations}}
271271
}
272+
273+
namespace PR45063 {
274+
template<class=class a::template b<>> struct X {}; // expected-error {{undeclared identifier 'a'}}
275+
}

0 commit comments

Comments
 (0)