]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Support decloned cdtors
authorNathaniel Shead <nathanieloshead@gmail.com>
Tue, 20 Aug 2024 15:08:36 +0000 (01:08 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Thu, 24 Oct 2024 21:13:22 +0000 (08:13 +1100)
commit29efc621b7c66ec67d10fc87cddbb3f1ab709fb2
treea637e77f530261778e7e7222dcc4bebbedb7c74c
parent058ed8705a7b38bef2c107b6ff5de243aebd57b4
c++/modules: Support decloned cdtors

When compiling with '-fdeclone-ctor-dtor' (enabled by default with -Os),
we run into issues where we don't correctly emit the underlying
functions.  We also need to ensure that COMDAT constructors are marked
as such before 'maybe_clone_body' attempts to propagate COMDAT groups to
the new thunks.

gcc/cp/ChangeLog:

* module.cc (post_load_processing): Mark COMDAT as needed, emit
declarations if maybe_clone_body fails.

gcc/testsuite/ChangeLog:

* g++.dg/modules/clone-2_a.C: New test.
* g++.dg/modules/clone-2_b.C: New test.
* g++.dg/modules/clone-3_a.C: New test.
* g++.dg/modules/clone-3_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/clone-2_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/clone-2_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/clone-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/clone-3_b.C [new file with mode: 0644]