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

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

https://gcc.gnu.org/g:d4e0bdbc036644401f9de49f594b2bb16b287381

commit r11-7835-gd4e0bdbc036644401f9de49f594b2bb16b287381
Author: Marek Polacek <pola...@redhat.com>
Date:   Fri Mar 5 15:46:50 2021 -0500

    c++: ICE on invalid with inheriting constructors [PR94751]

    This is an ICE on invalid where we crash because since r269032 we
    keep error_mark_node around instead of using noexcept_false_spec
    when things go wrong; see the walk_field_subobs hunk.

    We crash in deduce_inheriting_ctor which calls synthesized_method_walk
    to deduce the exception-specification, but fails to do so in this case,
    because the testcase is invalid so get_nsdmi returns error_mark_node for
    the member 'c', and per r269032 the error_mark_node propagates back to
    deduce_inheriting_ctor which subsequently calls build_exception_variant
    whereon we crash.  I think we should return early if the deduction fails
    and I decided to call mark_used to get an error right away instead of
    hoping that it would get called later.  My worry is that we could forget
    that there was an error and think that we just deduced noexcept(false).

    And then I noticed that the test still crashes in C++98.  Here again we
    failed to deduce the exception-specification in implicitly_declare_fn,
    but nothing reported an error between synthesized_method_walk and the
    assert.  Well, not much we can do except calling synthesized_method_walk
    again, this time in the verbose mode and making sure that we did get an
    error.

    gcc/cp/ChangeLog:

            PR c++/94751
            * call.c (build_over_call): Maybe call mark_used in case
            deduce_inheriting_ctor fails and return error_mark_node.
            * cp-tree.h (deduce_inheriting_ctor): Adjust declaration.
            * method.c (deduce_inheriting_ctor): Return bool if the deduction
            fails.
            (implicitly_declare_fn): If raises is error_mark_node, call
            synthesized_method_walk with diag being true.

    gcc/testsuite/ChangeLog:

            PR c++/94751
            * g++.dg/cpp0x/inh-ctor37.C: New test.
  • [Bug c++/94751] [9/10/11 Regres... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to