@@ -7159,7 +7159,10 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
7159
7159
// "effectively constexpr" for better compatibility.
7160
7160
// See https://github.com/llvm/llvm-project/issues/102293 for more info.
7161
7161
if (isa<CXXDestructorDecl>(M)) {
7162
- auto Check = [](QualType T, auto &&Check) -> bool {
7162
+ llvm::DenseSet<QualType> Visited;
7163
+ auto Check = [&Visited](QualType T, auto &&Check) -> bool {
7164
+ if (!Visited.insert(T).second)
7165
+ return false;
7163
7166
const CXXRecordDecl *RD =
7164
7167
T->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
7165
7168
if (!RD || !RD->isCompleteDefinition())
@@ -7168,16 +7171,11 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
7168
7171
if (!RD->hasConstexprDestructor())
7169
7172
return false;
7170
7173
7171
- QualType CanUnqualT = T.getCanonicalType().getUnqualifiedType();
7172
7174
for (const CXXBaseSpecifier &B : RD->bases())
7173
- if (B.getType().getCanonicalType().getUnqualifiedType() !=
7174
- CanUnqualT &&
7175
- !Check(B.getType(), Check))
7175
+ if (!Check(B.getType(), Check))
7176
7176
return false;
7177
7177
for (const FieldDecl *FD : RD->fields())
7178
- if (FD->getType().getCanonicalType().getUnqualifiedType() !=
7179
- CanUnqualT &&
7180
- !Check(FD->getType(), Check))
7178
+ if (!Check(FD->getType(), Check))
7181
7179
return false;
7182
7180
return true;
7183
7181
};
0 commit comments