[Bug c++/93413] Defaulted constexpr Destructor not being found during constant evaluation

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 3 18:56:33 GMT 2022


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

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

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

commit r13-3638-gc0b38e9fec71dc4cc5e99b1f0cb159c15a8da9ba
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Nov 3 14:55:35 2022 -0400

    c++: constexpr error with defaulted virtual dtor [PR93413]

    We're rejecting the below testcase with

      error: 'virtual constexpr Base::~Base()' used before its definition
      error: 'virtual constexpr Derived::~Derived()' used before its definition

    due to special handling in mark_used added by r181272 to defer synthesis
    of virtual destructors until EOF (where we can set their linkage), which
    in turn makes them effectively unusable during constexpr evaluation.

    Fortunately it seems this special handling is unnecessary ever since
    r208030 enabled us to tentatively set linkage of all defaulted virtual
    destructors, including templated ones.  So this patch gets rid of this
    special handling.

            PR c++/93413

    gcc/cp/ChangeLog:

            * decl2.cc (mark_used): Don't defer synthesis of virtual
            functions.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/constexpr-virtual21.C: New test.


More information about the Gcc-bugs mailing list