[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#103980: g++-3.0: copies constructors



Hi,

you write that "apparently", g++ 3.0 tries a longer conversion chain
than 2.95.  Indeed, the compiler message let us think so.  But to
verify this, I added traces into your testcase.  The result is that
both g++ versions use the same conversion chain (and indeed g++ 3.0
takes much longer to compile) :

$ ./a.out 
non const aios->aiosout

So the only problem here seems to be the compilation speed.  Perhaps
g++ 3.0 has to take into account more copy constructors for the
conversion chain computation than g++ 2.95 in order to comply with more
complex new C++ rules ?

-- 
Laurent.

#include <iostream>

using namespace std;

class aios {
  friend class aiosout;

public:
  aios (){}
  ~aios (){}
};

class aiosout {
  aiosout &operator= (const aiosout &);
public:
  aiosout (const aiosout &o){
    cout<<"const aiosout->aiosout"<<endl;
  }
  aiosout (aios &a) {
    cout<<"non const aios->aiosout"<<endl;
  }
  ~aiosout () {}
};

template<class T> inline const aiosout&
operator<< (const aiosout &o, const T &a)
{
  cout<<a<<endl;
  return o;
}

int main(void)
{
  aios a;
  a << 10;
}



Reply to: