This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/3013: templated inline function not inlined



>Number:         3013
>Category:       c++
>Synopsis:       templated inline function not inlined
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 31 10:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     buschelm@mcs.anl.gov
>Release:        unknown-1.0
>Organization:
>Environment:
linux
>Description:
The following function, add<4,float>, is not inlined by g++ all versions including the online 3.0 from Code Sourcery (as of today 5/31/01).

<begin file add.cc>

#define SIZE 4

template <int N,class T> inline int add(T*a,T*b) {
  for (int i=0;i<N;i++) a[i]+=b[i];
  return(0);
}

int main(int argc,char *argv[]) {
  float a[SIZE], b[SIZE];
  for (int i=0;i<SIZE;i++) a[i]=b[i]=(float)i;

  add<SIZE>(a,b);
  return(0);
}

<end file add.cc>
>How-To-Repeat:
g++ -S add.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]