Bug 20340 - __always_inline__ fails on templetized function for no reason
Summary: __always_inline__ fails on templetized function for no reason
Status: RESOLVED DUPLICATE of bug 14950
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2005-03-06 09:41 UTC by Yuri
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Yuri 2005-03-06 09:41:11 UTC
Compiling code below (g++ -O5 -c) fails with the error message below.
This is the major source of performance loss since it leaves silly functions
like this called zillions of times w/out inlining.

Any workaround ?


---- code ----
template<typename T> __attribute__ ((__always_inline__)) T f(const T j) { return
(j); }

int x(int j) {
  int r;
  r = f(j);
  return (r);

---- error message ----
i.C:2: sorry, unimplemented: inlining failed in call to 'T f(T) [with T = int]':
function not inlinable
i.C:6: sorry, unimplemented: called from here
Comment 1 Yuri 2005-03-06 10:45:30 UTC
actually this one is fixed in 4.0, problem though is that 4.0 isn't usable yet
Comment 2 Andrew Pinski 2005-03-06 15:10:05 UTC

*** This bug has been marked as a duplicate of 14950 ***