Skip to content

Commit 44c3a63

Browse files
committed
PR45063: Fix crash on invalid processing an elaborated class template-id
with an invalid scope specifier.
1 parent 755e008 commit 44c3a63

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
@@ -3814,6 +3814,9 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
38143814
SourceLocation LAngleLoc,
38153815
ASTTemplateArgsPtr TemplateArgsIn,
38163816
SourceLocation RAngleLoc) {
3817+
if (SS.isInvalid())
3818+
return TypeResult(true);
3819+
38173820
TemplateName Template = TemplateD.get();
38183821

38193822
// 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)