This is the mail archive of the gcc-bugs@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++: inlining issues


Hi!

I'm almost sure you are aware of the problem, but I thought a bug report
couldn't hurt:

Consider the following code:

class foo
{
  public:
    float x;

    foo (float xval)
      : x (xval) {}

    foo operator+ (const foo &foo2) const
      { return foo (x+foo2.x); }
};

int main()
{
  foo f=foo(1)+foo(2);
}

The current compiler (CVS 991206 with inlining on trees still enabled) gives the following output:

~/temp>/afs/mpa/data/martin/egcscvs/bin/g++ -v
Reading specs from /afs/mpa/data/martin/egcscvs/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 19991206 (experimental)

~/temp>/afs/mpa/data/martin/egcscvs/bin/g++ -O2 -Winline test.cxx
test.cxx: In function `int main ()':
test.cxx:10: warning: can't inline call to `foo foo::operator + (const foo &) const'
test.cxx:15: warning: called from here
test.cxx:7: warning: can't inline call to `foo::foo (float)'
test.cxx:15: warning: called from here

This seems like a regression.

Cheers,
  Martin


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