Author: Younan Zhang Date: 2025-09-21T21:55:59+08:00 New Revision: 90a6b0002d1ba7d6cbfe67942bf7499f1f011d65
URL: https://github.com/llvm/llvm-project/commit/90a6b0002d1ba7d6cbfe67942bf7499f1f011d65 DIFF: https://github.com/llvm/llvm-project/commit/90a6b0002d1ba7d6cbfe67942bf7499f1f011d65.diff LOG: [Clang] Fix an error-recovery crash after d1a80dea (#159976) d1a80dea tried to ensure a TypeSourceInfo for a destructor name. However, we don't actually have one during error recovery, so we should bail in that case. No release note, since it's a regression and a backport could improve the stability of clangd. Fixes https://github.com/llvm/llvm-project/issues/159630 Added: Modified: clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaTemplate/destructor-template.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 1e8bb6e3064a9..293097fd708fb 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -354,6 +354,8 @@ ParsedType Sema::getDestructorName(const IdentifierInfo &II, CheckTypenameType(ElaboratedTypeKeyword::None, SourceLocation(), SS.getWithLocInContext(Context), II, NameLoc, &TSI, /*DeducedTSTContext=*/true); + if (T.isNull()) + return ParsedType(); return CreateParsedType(T, TSI); } diff --git a/clang/test/SemaTemplate/destructor-template.cpp b/clang/test/SemaTemplate/destructor-template.cpp index 7a3398308bbee..734269e854e5d 100644 --- a/clang/test/SemaTemplate/destructor-template.cpp +++ b/clang/test/SemaTemplate/destructor-template.cpp @@ -104,3 +104,18 @@ struct T : S { ~T() = default; }; } // namespace PR38671 + +namespace GH159630 { + +struct X { + template<typename T> + struct typo { // expected-note {{'typo' declared here}} + ~typo(); + }; +}; + +template<typename T> +X::typo<T>::typ0::~typ0() {} // expected-error {{no member named 'typ0'}} \ + // expected-error {{no type named 'typ0'}} + +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
