This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3702: g++-3.0 copies constructors
- To: gcc-gnats at gcc dot gnu dot org, debian-gcc at lists dot debian dot org
- Subject: c++/3702: g++-3.0 copies constructors
- From: Matthias Klose <doko at klose dot in-berlin dot de>
- Date: Tue, 17 Jul 2001 03:21:58 +0200
- Reply-To: 103980-quiet at bugs dot debian dot org
>Number: 3702
>Category: c++
>Synopsis: g++-3.0 copies constructors
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 16 18:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Jaakko Niemi <liiwi@iki.fi>
>Release: 3.0 (Debian GNU/Linux)
>Organization:
The Debian project
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: i686
host: i386-linux
build: i386-linux
target: i386-linux
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #103980.
Please CC 103980-quiet@bugs.debian.org on replies.
Log of report can be found at http://bugs.debian.org/103980
sfs report: http://www.mit.edu:8008/snafu.fooworld.org/sfs/116
]
SFS (secure file system) 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
a << 10;
}
-----
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: