]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Propagate bits to DECL_MAYBE_DELETED dups [PR119462]
authorNathaniel Shead <nathanieloshead@gmail.com>
Fri, 4 Apr 2025 08:08:40 +0000 (19:08 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Fri, 4 Apr 2025 23:28:48 +0000 (10:28 +1100)
commitf4a3ae1ef5ec951f007c4bd530f30e44945c5f0d
treea06c0cf7ca6980267c6f90a3b52f495a61ce1035
parent6602fc076a883cf0cd20a37655a6bd9c146a2770
c++/modules: Propagate bits to DECL_MAYBE_DELETED dups [PR119462]

In the linked PR, we're importing over a DECL_MAYBE_DELETED decl with a
decl that has already been instantiated.  This patch ensures that the
needed bits are propagated across and that DECL_MAYBE_DELETED is cleared
from the existing decl, so that later synthesize_method doesn't crash
due to a definition unexpectedly already existing.

PR c++/119462

gcc/cp/ChangeLog:

* module.cc (trees_in::is_matching_decl): Propagate exception
spec and constexpr to DECL_MAYBE_DELETED; clear if appropriate.

gcc/testsuite/ChangeLog:

* g++.dg/modules/noexcept-3_a.C: New test.
* g++.dg/modules/noexcept-3_b.C: New test.
* g++.dg/modules/noexcept-3_c.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/noexcept-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/noexcept-3_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/noexcept-3_c.C [new file with mode: 0644]