r194296 - Use rauw for all discardable aliases, not just linkonce_odr.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Nov 26 18:04:42 PST 2013

>> If I'm remembering correctly, it goes something like:  If something is marked __always_inline__, it doesn't get outlined when the templated is explicitly instantiated into a source (which I believe is correct behavior).  However when the client needs an __always_inline__ and the type is marked extern template, the client assumes it can find the symbol outlined elsewhere (which I believe is incorrect behavior).
> No, code is produce when we do an explicit template instantiation.
> template<typename T>
> struct foo {
>   __attribute__((always_inline))void f() {
>   }
> };
> template struct foo<int>;
> produces:
> define weak_odr void @_ZN3fooIiE1fEv
> with a alwaysinline attribute.
> I think we have to do this, since someone can take a function pointer
> to f, in which case always_inline fails. We will avoid the
> optimization that made the problem more visible for now, but we should
> probably figure out a better way to get the desired effect in libc++.

This is indeed an issue. I have reported pr18074 with an example where
we get an undefined reference with any optimization level.


More information about the cfe-commits mailing list