[clang][bytecode] Fix discarding block expressions (#112185)

This commit is contained in:
Timm Baeder 2024-10-14 15:11:39 +02:00 committed by GitHub
parent f3947aaa37
commit 4c78c8cc21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -3416,6 +3416,9 @@ bool Compiler<Emitter>::VisitCXXDeleteExpr(const CXXDeleteExpr *E) {
template <class Emitter>
bool Compiler<Emitter>::VisitBlockExpr(const BlockExpr *E) {
if (DiscardResult)
return true;
const Function *Func = nullptr;
if (auto F = Compiler<ByteCodeEmitter>(Ctx, P).compileObjCBlock(E))
Func = F;

View File

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