------- Comment #2 from pinskia at gcc dot gnu dot org 2008-01-31 19:51 ------- Hi, namespace has nothing to do with the issue, The problem can be summarized as follows: if you have a declaration of the template function without always_inline and the definition with, the instationation does not get always_inline.
Take this testcase: template <class T> const T& min(const T& a, const T& b); template <class T> inline __attribute__ ((always_inline)) const T& min(const T& a, const T& b) { return a < b ? a : b; } int main() { int a, b; return min(a, b); } We don't inline min into main if we remove the declaration, we do. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|tree-optimization |c++ Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2008-01-31 19:51:49 date| | Summary|always_inline does not seem |always_inline with templates |to force inlining when used |and not declared as |only in the definition of a |always_inline but definition |function in a namespace |has it http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34715