is it a g++ bug ?

Levente Farkas lfarkas@mindmaker.hu
Wed Nov 22 03:05:00 GMT 2000


hi,
why the following code not compile ?:
so why the compiler can't find the placement new and how can I force it ?
thanks.
---------------------------
template<typename T>
class A
{
public:
  explicit A(T t = 0) : data(t) {}

  template<typename T1>
    A(const A<T1>& that) : data(T(that.data)) {}

  template<typename T1>
    A& operator=(const A<T1>& that)
  {
    if (this != (void*)&that)
    {
      this->~A();
      new(this) A(that);
    }
    return *this;
  }
  T data;
};

int main()
{
  A<double> x(2.0);
  A<int> y(x);

  x = y;
  return 0;
}
---------------------------
 
 -- Levente
 "The only thing worse than not knowing the truth is
  ruining the bliss of ignorance."


More information about the Libstdc++ mailing list