File tree 2 files changed +22
-5
lines changed
2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -2916,11 +2916,7 @@ template <class Emitter>
2916
2916
bool ByteCodeExprGen<Emitter>::VisitCXXDefaultInitExpr(
2917
2917
const CXXDefaultInitExpr *E) {
2918
2918
SourceLocScope<Emitter> SLS (this , E);
2919
- if (Initializing)
2920
- return this ->visitInitializer (E->getExpr ());
2921
-
2922
- assert (classify (E->getType ()));
2923
- return this ->visit (E->getExpr ());
2919
+ return this ->delegate (E->getExpr ());
2924
2920
}
2925
2921
2926
2922
template <class Emitter >
Original file line number Diff line number Diff line change @@ -1264,3 +1264,24 @@ namespace {
1264
1264
static_assert (true_type::value, " " );
1265
1265
static_assert (true_type::value, " " );
1266
1266
}
1267
+
1268
+ #if __cplusplus >= 202002L
1269
+ namespace {
1270
+ // / Used to crash because the CXXDefaultInitExpr is of compound type.
1271
+ struct A {
1272
+ int &x;
1273
+ constexpr ~A () { --x; }
1274
+ };
1275
+ struct B {
1276
+ int &x;
1277
+ const A &a = A{x};
1278
+ };
1279
+ constexpr int a () {
1280
+ int x = 1 ;
1281
+ int f = B{x}.x ;
1282
+ B{x}; // both-warning {{expression result unused}}
1283
+
1284
+ return 1 ;
1285
+ }
1286
+ }
1287
+ #endif
You can’t perform that action at this time.
0 commit comments