https://gcc.gnu.org/g:868a11b2f9a874071112f43cacdd65d5d399c26a
commit r15-10084-g868a11b2f9a874071112f43cacdd65d5d399c26a Author: Iain Sandoe <i...@sandoe.co.uk> Date: Sat May 10 17:12:44 2025 +0100 c++: Set the outer brace marker for missed cases. In some cases, a function might be declared as FUNCTION_NEEDS_BODY_BLOCK but all the content is contained within that block. However, poplevel is currently assuming that such cases would always contain subblocks. In the case that we do have a body block, but there are no subblocks then st the outer brace marker on the body block. This situation occurs for at least coroutine lambda ramp functions and empty constructors. gcc/cp/ChangeLog: * decl.cc (poplevel): Set BLOCK_OUTER_CURLY_BRACE_P on the body block for functions with no subblocks. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> (cherry picked from commit 689bc394efe9e042acb37799deec6568c0f63a45) Diff: --- gcc/cp/decl.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 4e97093b1341..9cf75936d7af 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -846,11 +846,9 @@ poplevel (int keep, int reverse, int functionbody) DECL_INITIAL (current_function_decl) = block ? block : subblocks; if (subblocks) { - if (FUNCTION_NEEDS_BODY_BLOCK (current_function_decl)) - { - if (BLOCK_SUBBLOCKS (subblocks)) - BLOCK_OUTER_CURLY_BRACE_P (BLOCK_SUBBLOCKS (subblocks)) = 1; - } + if (FUNCTION_NEEDS_BODY_BLOCK (current_function_decl) + && BLOCK_SUBBLOCKS (subblocks)) + BLOCK_OUTER_CURLY_BRACE_P (BLOCK_SUBBLOCKS (subblocks)) = 1; else BLOCK_OUTER_CURLY_BRACE_P (subblocks) = 1; }