[llvm-branch-commits] [clang] release/21.x: [Clang] Fix an error-recovery crash after d1a80dea (#159976) (PR #159980)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Sep 21 07:03:53 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport 90a6b000
Requested by: @<!-- -->zyn0217
---
Full diff: https://github.com/llvm/llvm-project/pull/159980.diff
2 Files Affected:
- (modified) clang/lib/Sema/SemaExprCXX.cpp (+2)
- (modified) clang/test/SemaTemplate/destructor-template.cpp (+15)
``````````diff
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 25afa2f4dfe7a..a08971c6526fe 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -347,6 +347,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'}}
+
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/159980
More information about the llvm-branch-commits
mailing list