@@ -1170,29 +1170,33 @@ static void pushTemporaryCleanup(CIRGenFunction &cgf,
1170
1170
return ;
1171
1171
}
1172
1172
1173
- CXXDestructorDecl *referenceTemporaryDtor = nullptr ;
1174
- if (const clang::RecordType *rt = e->getType ()
1175
- ->getBaseElementTypeUnsafe ()
1176
- ->getAs <clang::RecordType>()) {
1177
- // Get the destructor for the reference temporary.
1178
- if (const auto *classDecl = dyn_cast<CXXRecordDecl>(
1179
- rt->getOriginalDecl ()->getDefinitionOrSelf ())) {
1180
- if (!classDecl->hasTrivialDestructor ())
1181
- referenceTemporaryDtor =
1182
- classDecl->getDefinitionOrSelf ()->getDestructor ();
1183
- }
1184
- }
1185
-
1186
- if (!referenceTemporaryDtor)
1173
+ const QualType::DestructionKind dk = e->getType ().isDestructedType ();
1174
+ if (dk == QualType::DK_none)
1187
1175
return ;
1188
1176
1189
- // Call the destructor for the temporary.
1190
1177
switch (m->getStorageDuration ()) {
1191
1178
case SD_Static:
1192
- case SD_Thread:
1193
- cgf.cgm .errorNYI (e->getSourceRange (),
1194
- " pushTemporaryCleanup: static/thread storage duration" );
1195
- return ;
1179
+ case SD_Thread: {
1180
+ CXXDestructorDecl *referenceTemporaryDtor = nullptr ;
1181
+ if (const clang::RecordType *rt = e->getType ()
1182
+ ->getBaseElementTypeUnsafe ()
1183
+ ->getAs <clang::RecordType>()) {
1184
+ // Get the destructor for the reference temporary.
1185
+ if (const auto *classDecl = dyn_cast<CXXRecordDecl>(
1186
+ rt->getOriginalDecl ()->getDefinitionOrSelf ())) {
1187
+ if (!classDecl->hasTrivialDestructor ())
1188
+ referenceTemporaryDtor =
1189
+ classDecl->getDefinitionOrSelf ()->getDestructor ();
1190
+ }
1191
+ }
1192
+
1193
+ if (!referenceTemporaryDtor)
1194
+ return ;
1195
+
1196
+ cgf.cgm .errorNYI (e->getSourceRange (), " pushTemporaryCleanup: static/thread "
1197
+ " storage duration with destructors" );
1198
+ break ;
1199
+ }
1196
1200
1197
1201
case SD_FullExpression:
1198
1202
cgf.pushDestroy (NormalAndEHCleanup, referenceTemporary, e->getType (),
0 commit comments