[cfe-commits] [cfe-dev] anchoring explicit template instantiations

Douglas Gregor dgregor at apple.com
Sun Jan 29 11:17:47 PST 2012


On Jan 29, 2012, at 11:13 AM, Rafael EspĂ­ndola wrote:

>>> Ah, right - so using a explicit template declaration + definition in
>>> C++11 means that any TU seeing the declaration can avoid emitting the
>>> template instantiation (& rely on some other TU to provide it) but it
>>> doesn't guarantee that some 3rd TU might never see the declaration and
>>> go ahead and instantiate it anyway - thus the symbols must remain
>>> weak.
>> 
>> Exactly.
> 
> Why? Since it is invalid to have two explicit template instantiation
> definitions, there would be at most one strong symbol and the static
> linker would always select it, no?
> 
> Is it a problem with some dynamic linkers?


It's an issue with the Mac OS X dynamic linker, which sees a strong symbol and concludes that it doesn't need to consider merging with weak symbols. 

	- Doug



More information about the cfe-commits mailing list