[cfe-dev] Clang emits unreachable `internal linkage` constructor

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 19 09:14:08 PDT 2016


On Thu, Oct 13, 2016 at 10:46 PM, Mehdi Amini via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> The problem is that the linkage “available_externally" is a “lie”: there
> is an external template instantiation in the header, but it is marked
> “visibility hidden”. So the function cannot be linked to in the libc++
> dylib. (I think it’d work with a static libc++).
>

IMO this is the real problem. If basic_string isn't actually available
externally, why have explicit template instaniation declarations in
<string>? IIRC John put these back for some reason, but if all of
basic_string is always_inline, what is the point?

I also think libc++ should stop abusing always_inline for linkage purposes.
We should use __attribute__((internal_linkage)) instead, and allow the
optimizer to make informed inlining decisions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161019/0d7e649e/attachment.html>


More information about the cfe-dev mailing list