]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Fix handling of -fdeclone-ctor-dtor with explicit instantiations [PR120125]
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 8 May 2025 13:06:13 +0000 (23:06 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Wed, 14 May 2025 09:42:43 +0000 (19:42 +1000)
commit6b1a99c3e2cf0fb858ad42b19c6834f7593f091d
tree5cfb2b5fc0bcd705991d57d96d0587d513471707
parent74b9ae09ed94e58a7e61184fa3f592144fb3b2d0
c++/modules: Fix handling of -fdeclone-ctor-dtor with explicit instantiations [PR120125]

The attached testcase ICEs in maybe_thunk_body because we haven't
created a node in the cgraph for an imported explicit instantiation yet.

We in fact really shouldn't be emitting calls at all, since an imported
explicit instantiation always exists in the TU we imported it from.  But
the required logic for that doesn't exist in this branch, so we'll just
xfail the relevant check.

PR c++/120125

gcc/cp/ChangeLog:

* optimize.cc (maybe_thunk_body): Don't assume 'fn' has a cgraph
node created.

gcc/testsuite/ChangeLog:

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

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