@@ -7172,7 +7172,10 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
7172
7172
// "effectively constexpr" for better compatibility.
7173
7173
// See https://github.com/llvm/llvm-project/issues/102293 for more info.
7174
7174
if (isa<CXXDestructorDecl>(M)) {
7175
- auto Check = [](QualType T, auto &&Check) -> bool {
7175
+ llvm::DenseSet<QualType> Visited;
7176
+ auto Check = [&Visited](QualType T, auto &&Check) -> bool {
7177
+ if (!Visited.insert(T).second)
7178
+ return false;
7176
7179
const CXXRecordDecl *RD =
7177
7180
T->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
7178
7181
if (!RD || !RD->isCompleteDefinition())
@@ -7181,16 +7184,11 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
7181
7184
if (!RD->hasConstexprDestructor())
7182
7185
return false;
7183
7186
7184
- QualType CanUnqualT = T.getCanonicalType().getUnqualifiedType();
7185
7187
for (const CXXBaseSpecifier &B : RD->bases())
7186
- if (B.getType().getCanonicalType().getUnqualifiedType() !=
7187
- CanUnqualT &&
7188
- !Check(B.getType(), Check))
7188
+ if (!Check(B.getType(), Check))
7189
7189
return false;
7190
7190
for (const FieldDecl *FD : RD->fields())
7191
- if (FD->getType().getCanonicalType().getUnqualifiedType() !=
7192
- CanUnqualT &&
7193
- !Check(FD->getType(), Check))
7191
+ if (!Check(FD->getType(), Check))
7194
7192
return false;
7195
7193
return true;
7196
7194
};
0 commit comments