[Bug c++/101532] [12 Regression] ICE in finish_expr_stmt, at cp/semantics.c:859

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 9 23:32:53 GMT 2022


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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

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

commit r10-10602-gad0398474aff6bb7726e9117711b0a111a4b69e7
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jan 25 15:04:49 2022 -0500

    c++: deleted fn and noexcept inst [PR101532, PR104225]

    Here when attempting to use B's implicitly deleted default constructor,
    mark_used rightfully returns false, but for the wrong reason: it
    tries to instantiate the synthesized noexcept specifier which then only
    silently fails because get_defaulted_eh_spec suppresses diagnostics
    for deleted functions.  This lack of diagnostics causes us to crash on
    the first testcase below (thanks to the assert in finish_expr_stmt), and
    silently accept the second testcase.

    To fix this, this patch makes mark_used avoid attempting to instantiate
    the noexcept specifier of a deleted function, so that we'll instead
    directly reject (and diagnose) the function due to its deletedness.

            PR c++/101532
            PR c++/104225

    gcc/cp/ChangeLog:

            * decl2.c (mark_used): Don't consider maybe_instantiate_noexcept
            on a deleted function.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/nsdmi-template21.C: New test.
            * g++.dg/cpp0x/nsdmi-template21a.C: New test.

    (cherry picked from commit bc90dd0ecf02e11d47d1af7f627e2e2acaa40106)


More information about the Gcc-bugs mailing list