@@ -1318,15 +1318,6 @@ bool Compiler<Emitter>::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) {
1318
1318
template <class Emitter >
1319
1319
bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1320
1320
const Expr *ArrayFiller, const Expr *E) {
1321
-
1322
- QualType QT = E->getType ();
1323
-
1324
- if (const auto *AT = QT->getAs <AtomicType>())
1325
- QT = AT->getValueType ();
1326
-
1327
- if (QT->isVoidType ())
1328
- return this ->emitInvalid (E);
1329
-
1330
1321
// Handle discarding first.
1331
1322
if (DiscardResult) {
1332
1323
for (const Expr *Init : Inits) {
@@ -1336,6 +1327,13 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits,
1336
1327
return true ;
1337
1328
}
1338
1329
1330
+ QualType QT = E->getType ();
1331
+ if (const auto *AT = QT->getAs <AtomicType>())
1332
+ QT = AT->getValueType ();
1333
+
1334
+ if (QT->isVoidType ())
1335
+ return this ->emitInvalid (E);
1336
+
1339
1337
// Primitive values.
1340
1338
if (std::optional<PrimType> T = classify (QT)) {
1341
1339
assert (!DiscardResult);
@@ -3251,12 +3249,9 @@ template <class Emitter> bool Compiler<Emitter>::visit(const Expr *E) {
3251
3249
if (E->getType ().isNull ())
3252
3250
return false ;
3253
3251
3254
- if (E->getType ()->isVoidType ())
3255
- return this ->discard (E);
3256
-
3257
3252
// Create local variable to hold the return value.
3258
- if (!E->isGLValue () && !E->getType ()-> isAnyComplexType () &&
3259
- !classify (E->getType ())) {
3253
+ if (!E->getType ()-> isVoidType () && !E->isGLValue () &&
3254
+ !E-> getType ()-> isAnyComplexType () && ! classify (E->getType ())) {
3260
3255
std::optional<unsigned > LocalIndex = allocateLocal (E);
3261
3256
if (!LocalIndex)
3262
3257
return false ;
0 commit comments