Skip to content

Commit 90a6b00

Browse files
authored
[Clang] Fix an error-recovery crash after d1a80de (#159976)
d1a80de 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 #159630
1 parent b716d35 commit 90a6b00

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ ParsedType Sema::getDestructorName(const IdentifierInfo &II,
354354
CheckTypenameType(ElaboratedTypeKeyword::None, SourceLocation(),
355355
SS.getWithLocInContext(Context), II, NameLoc, &TSI,
356356
/*DeducedTSTContext=*/true);
357+
if (T.isNull())
358+
return ParsedType();
357359
return CreateParsedType(T, TSI);
358360
}
359361

clang/test/SemaTemplate/destructor-template.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,18 @@ struct T : S {
104104
~T() = default;
105105
};
106106
} // namespace PR38671
107+
108+
namespace GH159630 {
109+
110+
struct X {
111+
template<typename T>
112+
struct typo { // expected-note {{'typo' declared here}}
113+
~typo();
114+
};
115+
};
116+
117+
template<typename T>
118+
X::typo<T>::typ0::~typ0() {} // expected-error {{no member named 'typ0'}} \
119+
// expected-error {{no type named 'typ0'}}
120+
121+
}

0 commit comments

Comments
 (0)