> Right now ~moneypunct_byname() is attributed with __always_inline__, meaning 
> it should never be part of libc++.dylib.  That being said, moneypunct_byname 
> is also extern templates for the required instantiations, and there is a 
> poorly understood bad interaction between __always_inline__ and extern 
> template.  That could very well be at the base of this problem here.
>
> 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++.



>
> I may be remembering incorrectly...
>
> Howard
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to