This is the mail archive of the 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++/3702: g++-3.0 copies constructors

>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
>Originator:     Jaakko Niemi <>
>Release:        3.0 (Debian GNU/Linux)
The Debian project
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
[ Reported to the Debian BTS as report #103980.
  Please CC on replies.
  Log of report can be found at
  sfs report:

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;

  aios ();
  ~aios ();

class aiosout {
  aiosout (const aiosout &o);
  aiosout &operator= (const aiosout &);
  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;


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