c++: Keep DECL_SAVED_TREE of cdtor instantiations in modules [PR104040]
commit0774240b4df9a9bc48ce33a9625788e402498f5a
authorNathaniel Shead <nathanieloshead@gmail.com>
Fri, 29 Mar 2024 02:53:54 +0000 (29 13:53 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Wed, 10 Apr 2024 01:40:32 +0000 (10 11:40 +1000)
treee743ff4b4ff399e598a17adce6482b829bd66be9
parentea665f90260acb3ffd2e39fcd2e200e702ee0ead
c++: Keep DECL_SAVED_TREE of cdtor instantiations in modules [PR104040]

A template instantiation still needs to have its DECL_SAVED_TREE so that
its definition is emitted into the CMI. This way it can be emitted in
the object file of any importers that use it, in case it doesn't end up
getting emitted in this TU.

This is true even for maybe-in-charge functions, because we don't
currently stream the clones directly but instead regenerate them from
this function.

PR c++/104040

gcc/cp/ChangeLog:

* semantics.cc (expand_or_defer_fn_1): Keep DECL_SAVED_TREE for
all vague linkage cdtors with modules.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr104040_a.C: New test.
* g++.dg/modules/pr104040_b.C: New test.

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