Skip to content

Commit 7645823

Browse files
committed
[clang][Interp] Don't require StmtExpr result to be an expression
It can be a statement containing an expression.
1 parent 6b380a8 commit 7645823

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/AST/Interp/Compiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,13 +3073,13 @@ bool Compiler<Emitter>::VisitStmtExpr(const StmtExpr *E) {
30733073
}
30743074

30753075
assert(S == Result);
3076-
// This better produces a value (i.e. is an expression).
30773076
if (const Expr *ResultExpr = dyn_cast<Expr>(S)) {
30783077
if (DiscardResult)
30793078
return this->discard(ResultExpr);
30803079
return this->delegate(ResultExpr);
30813080
}
3082-
return false;
3081+
3082+
return this->visitStmt(S);
30833083
}
30843084

30853085
return BS.destroyLocals();

clang/test/CodeGenCXX/cxx1z-constexpr-if.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -fblocks -triple x86_64-apple-darwin10 -o - | FileCheck %s --implicit-check-not=should_not_be_used
2+
// RUN: %clang_cc1 -std=c++1z %s -emit-llvm -fblocks -triple x86_64-apple-darwin10 -o - -fexperimental-new-constant-interpreter | FileCheck %s --implicit-check-not=should_not_be_used
23

34
void should_be_used_1();
45
void should_be_used_2();

0 commit comments

Comments
 (0)