Missing implicitly declared member functions

Valentin Bonnard bonnardv@pratique.fr
Wed Nov 11 07:57:00 GMT 1998


Klaus-Georg Adams wrote:
> 
> Valentin Bonnard writes:
> 
> > 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.

> how did you get the idea that operator&() should be implicitely
> declared and defined? 

Just a vague impression... sorry I haven't found it.

But the following should compile:

    struct T {} x;
    &x;

so I guess the compiler must generate operator&, right ?

Now I remember, I have read somewhere that there were two 
implicitly generated operator&. Perhaps it wasn't in the 
standard. Perhaps it's completly wrong. Sorry about any 
confusion generated.

-- 

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