Skip to content

Commit 95605ab

Browse files
tbaederrDanielCChen
authored andcommitted
[clang][bytecode] Fix discarding block expressions (llvm#112185)
1 parent 92e4c8b commit 95605ab

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,9 @@ bool Compiler<Emitter>::VisitCXXDeleteExpr(const CXXDeleteExpr *E) {
34163416

34173417
template <class Emitter>
34183418
bool Compiler<Emitter>::VisitBlockExpr(const BlockExpr *E) {
3419+
if (DiscardResult)
3420+
return true;
3421+
34193422
const Function *Func = nullptr;
34203423
if (auto F = Compiler<ByteCodeEmitter>(Ctx, P).compileObjCBlock(E))
34213424
Func = F;

clang/test/SemaCXX/block-packs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fsyntax-only -verify -Wno-unused %s
22
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fsyntax-only -verify -Wno-unused %s -frecovery-ast -frecovery-ast-type
33

4+
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fsyntax-only -verify -Wno-unused -fexperimental-new-constant-interpreter %s
5+
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fsyntax-only -verify -Wno-unused -frecovery-ast -frecovery-ast-type -fexperimental-new-constant-interpreter %s
6+
47
template <typename ...Ts>
58
void f() {
69
((^ { Ts t; }), ...);

0 commit comments

Comments
 (0)