Bug#103980: g++-3.0: copies constructors
Package: g++-3.0
Version: N/A
Severity: normal
SFS fails to compile with gcc 3.0, and it was tracked down to this
example code that reproduces the error:
-------------
class aios {
friend class aiosout;
public:
aios ();
~aios ();
};
class aiosout {
aiosout (const aiosout &o);
aiosout &operator= (const aiosout &);
public:
aiosout (aios &a) {}
~aiosout () {}
};
template<class T> inline const aiosout&
operator<< (const aiosout &o, const T &a)
{
return o;
}
void fault(void)
{
aios a;
// normally a C++ compiler should resolve the following like this:
// tmp = aiosout(a)
// operator<< (tmp, 10);
// apparently, g++ 3.0 tries to do something like this:
// tmp1 = aiosout(a)
// tmp2 = aiosout(tmp1) <== copy constructor (unusable!)
// operator<< (tmp2, 10);
// which is wasteful even when it works... maybe now we know why
// g++ is known to take so much longer to compile stuff...
a << 10;
}
-------------
If you try to reproduce this with SFS sources, please use the cvs
version, as it has other gcc 3 related fixes already in. You can find
the cvs instructions from http://www.fs.net.
If there is any other information that I can provide, please let me know.
Thanks.
-- System Information
Debian Release: testing/unstable
Kernel Version: Linux jumper 2.4.6 #1 Wed Jul 4 15:33:15 EEST 2001 i686 unknown
Reply to: