https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107755

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:5ce8961b46f050a96e8c542b34b1cf024ba95f1b

commit r13-5627-g5ce8961b46f050a96e8c542b34b1cf024ba95f1b
Author: Marek Polacek <pola...@redhat.com>
Date:   Tue Jan 31 14:36:30 2023 -0500

    c++: ICE with -Wlogical-op [PR107755]

    Here we crash in the middle end because warn_logical_operator calls
    build_range_check which calls various fold_* functions and those
    don't work too well when we're still processing template trees.  For
    instance here we crash because we're converting a RECORD_TYPE to bool.
    At this point VIEW_CONVERT_EXPR<struct Foo>(b) hasn't yet been converted
    to Foo::operator bool (&b).

    I was excited to fix this with instantiation_dependent_expression_p
    which can now be called from c-family/ as well, but the problem isn't
    that the expression is dependent.  So, p_t_d it is.

            PR c++/107755

    gcc/cp/ChangeLog:

            * call.cc (build_new_op): Don't call warn_logical_operator when
            processing a template.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wlogical-op-4.C: New test.

Reply via email to