Missing implicitly declared member functions

Valentin Bonnard bonnardv@pratique.fr
Tue Nov 10 10:23:00 GMT 1998


[ Perhaps it's a known limitation. ]

Given

    struct T { };

T should have 6 member functions implicitly declared by 
the compiler.

But two of them are missing in egcs:

struct T
{ 
  // T* operator& () { return this; }
};

int main ()
{
  T* (T::*a) () = &T::operator&; // ERROR
  const T* (T::*b) () const = &T::operator&; // ERROR
  T& (T::*c) (const T&) = &T::operator=; // OK
  T x;
  if (0)
    x.~T (); // OK
}

Both & are missing. If I uncomment the declaration 
of operator&, then the program compiles ! This is 
strange because I have only written one & and I use 
both.

brick-~ $ egcs -v
Reading specs from
/usr/local/util/packages/egcs-050798/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.45/specs
gcc version egcs-2.91.45 19980704 (gcc2 ss-980609 experimental)

-- 

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/



More information about the Gcc-bugs mailing list