On Thu, Aug 08, 2024 at 09:13:05AM +1000, Nathaniel Shead wrote:
> diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
> index 6c22ff55b46..03c19e4a7e4 100644
> --- a/gcc/cp/error.cc
> +++ b/gcc/cp/error.cc
> @@ -4782,12 +4782,14 @@ qualified_name_lookup_error (tree scope, tree name,
>                 scope);
>        else if (TREE_CODE (decl) == TREE_LIST)
>       {
> +       auto_diagnostic_group d;
>         error_at (location, "reference to %<%T::%D%> is ambiguous",
>                   scope, name);
>         print_candidates (decl);
>       }
>        else
>       {
> +       auto_diagnostic_group d;
>         name_hint hint;
>         if (SCOPED_ENUM_P (scope) && TREE_CODE (name) == IDENTIFIER_NODE)
>           hint = suggest_alternative_in_scoped_enum (name, scope);

I don't see why we need the second a_d_d here.

> @@ -3534,6 +3536,7 @@ finish_class_member_access_expr (cp_expr object, tree 
> name, bool template_p,
>        else
>       {
>         /* Look up the member.  */
> +       auto_diagnostic_group d;
>         access_failure_info afi;
>         if (processing_template_decl)
>           /* Even though this class member access expression is at this

I don't quite see why we need it here, either.

> @@ -10384,6 +10401,8 @@ convert_for_assignment (tree type, tree rhs,
>       {
>         if (complain & tf_error)
>           {
> +           auto_diagnostic_group d;
> +
>             /* If the right-hand side has unknown type, then it is an
>                overloaded function.  Call instantiate_type to get error
>                messages.  */
> @@ -10406,7 +10425,6 @@ convert_for_assignment (tree type, tree rhs,
>                   (rhs_loc,
>                    has_loc ? &label : NULL,
>                    has_loc ? highlight_colors::percent_h : NULL);
> -               auto_diagnostic_group d;

Oh I see, it was supposed to be in the outer block.  OK.

The patch looks good to me, thanks.

Marek

Reply via email to