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>