On Thu, Jan 29, 2026 at 07:06:52PM -0500, Marek Polacek wrote:
> @@ -5953,21 +5961,9 @@ eval_define_aggregate (location_t loc, const 
> constexpr_ctx *ctx,
>    tree cscope = NULL_TREE, tscope = NULL_TREE;
>    for (tree c = TYPE_CONTEXT (CP_DECL_CONTEXT (consteval_block)); c;
>         c = get_containing_scope (c))
> -    {
> -      if (c == type)
> -     {
> -       auto_diagnostic_group d;
> -       error_at (loc, "%<define_aggregate%> evaluated from "
> -                      "%<consteval%> block enclosed by %qT being "
> -                      "defined", type);
> -       inform (DECL_SOURCE_LOCATION (consteval_block),
> -               "%<consteval%> block defined here");
> -       return get_reflection_raw (loc, orig_type);
> -     }
> -      if (cscope == NULL_TREE
> -       && (TYPE_P (c) || TREE_CODE (c) == FUNCTION_DECL))
> -     cscope = c;
> -    }
> +    if (cscope == NULL_TREE
> +     && (TYPE_P (c) || TREE_CODE (c) == FUNCTION_DECL))
> +      cscope = c;

If this is now the sole body of the loop, we can also break;
once we set cscope to non-NULL, because there is no useful
work afterwards.  So make the body
    if (TYPE_P (c) || TREE_CODE (c) == FUNCTION_DECL)
      {
        cscope = c;
        break;
      }
instead?

        Jakub

Reply via email to