[Bug c++/87380] Explicit instantations should use weak symbols on darwin

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 21 15:35:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87380

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> The response from Apple quoted in 82172 comment 26 says that explicit

That should have said Bug 82172 comment 26.

The problem only arises when a template might get implicitly instantiated,
because an explicit instantiations declaration was not seen. In such an object
file can contain implicit instantations and the explicit instantiation in the
dylib isn't needed. Due to the linker behaviour, the two definitions are not
merged and remain separate.

In practice this probably only matters for symbols where the address is taken,
so that duplicate copies of the symbol with different addresses can cause
problems (which was the cause of Bug 82172).


More information about the Gcc-bugs mailing list