Skip to content

Commit 0b262bb

Browse files
committed
[clang][Interp] Properly reject StmtExprs with Stmt result
1 parent 05b586b commit 0b262bb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/lib/AST/Interp/Compiler.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,13 +3194,9 @@ bool Compiler<Emitter>::VisitStmtExpr(const StmtExpr *E) {
31943194
}
31953195

31963196
assert(S == Result);
3197-
if (const Expr *ResultExpr = dyn_cast<Expr>(S)) {
3198-
if (DiscardResult)
3199-
return this->discard(ResultExpr);
3197+
if (const Expr *ResultExpr = dyn_cast<Expr>(S))
32003198
return this->delegate(ResultExpr);
3201-
}
3202-
3203-
return this->visitStmt(S);
3199+
return this->emitUnsupported(E);
32043200
}
32053201

32063202
return BS.destroyLocals();

clang/test/AST/Interp/literals.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,10 @@ namespace StmtExprs {
12141214
return 76;
12151215
}
12161216
static_assert(foo() == 76, "");
1217+
1218+
namespace CrossFuncLabelDiff {
1219+
constexpr long a(bool x) { return x ? 0 : (long)&&lbl + (0 && ({lbl: 0;})); }
1220+
}
12171221
}
12181222
#endif
12191223

0 commit comments

Comments
 (0)