llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (llvmbot) <details> <summary>Changes</summary> Backport ec4e6aa Requested by: @<!-- -->ojhunt --- Full diff: https://github.com/llvm/llvm-project/pull/154210.diff 2 Files Affected: - (modified) clang/lib/Parse/ParseExpr.cpp (+2-1) - (added) clang/test/SemaObjCXX/discarded-block-type-inference.mm (+15) ``````````diff diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index bc238a9517a37..3515343202de1 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -3342,7 +3342,8 @@ ExprResult Parser::ParseBlockLiteralExpression() { Actions.ActOnBlockError(CaretLoc, getCurScope()); return ExprError(); } - + EnterExpressionEvaluationContextForFunction PotentiallyEvaluated( + Actions, Sema::ExpressionEvaluationContext::PotentiallyEvaluated); StmtResult Stmt(ParseCompoundStatementBody()); BlockScope.Exit(); if (!Stmt.isInvalid()) diff --git a/clang/test/SemaObjCXX/discarded-block-type-inference.mm b/clang/test/SemaObjCXX/discarded-block-type-inference.mm new file mode 100644 index 0000000000000..8e2587724a7f6 --- /dev/null +++ b/clang/test/SemaObjCXX/discarded-block-type-inference.mm @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fobjc-arc -fblocks %s + +void block_receiver(int (^)() ); + +int f1() { + if constexpr (0) + (block_receiver)(^{ return 2; }); + return 1; +} + +int f2() { + if constexpr (0) + return (^{ return 2; })(); + return 1; +} `````````` </details> https://github.com/llvm/llvm-project/pull/154210 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits