This is the mail archive of the gcc@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]
Other format: [Raw text]

always_inline + template failures (oops)


Sorry, due to mailer problems I got a wrong title...

Is it a bug or a feature that the following does not compile with -O0:

  $  cat t.cc
  template <class T> inline void Foo(T) __attribute__((always_inline));
  template <class T> inline void Foo(T) {}
  int main() 
  {
     int i; 
     Foo(i); 
  }
  $ $gcc34/bin/g++ -c t.cc
  t.cc: In function `int main()':
  t.cc:2: sorry, unimplemented: inlining failed in call to 'void Foo(T) 
[with T = int]': function body not available
  t.cc:6: sorry, unimplemented: called from here

When compiled with -O, it works OK. When the same is done without 
templates it works OK:

  $ cat t2.cc
  inline void Foo(int) __attribute__((always_inline));
  inline void Foo(int) {}
  int main()
  {
    int i;
    Foo(i);
  }

At any rate, gcc-3.4 is inconsistent.
Should I file a bug report? Or is it supposed to be this way?

  $ $gcc34/bin/g++ -v
  Reading specs from 
/home/veksler/gcc/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
  Configured with: ../gcc-3.4.0-20040406/configure 
--prefix=/home/veksler/gcc --enable-languages=c++
  Thread model: posix
  gcc version 3.4.0 20040407 (prerelease)


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