On 3/17/25 6:55 PM, Marek Polacek wrote:
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?

-- >8 --
We crash while we call warning_at ("inline function used but never defined")
since it invokes dump_template_bindings -> tsubst -> ... -> convert_like ->
... -> c_common_truthvalue_conversion -> warning_at ("enum constant in boolean
                                                     context")

cp_truthvalue_conversion correctly gets complain=0 but it calls
c_common_truthvalue_conversion from c-family which doesn't have
a similar parameter.

It seems that we try to prevent this in cp_convert_and_check with

          warning_sentinel c (warn_int_in_bool_context);

which is why we don't get a warning when we first instantiate the template.

But that doesn't help when we rebuild the expression for dump_template_bindings because the recursion check in report_diagnostic comes before the check whether the diagnostic is actually enabled.

I think rather than adding another mechanism for suppressing warnings, I'd like to make the existing ones work better by moving the recursion check after the checks for disabled diagnostics.

Jason

Reply via email to