Missing implicitly declared member functions

Alexandre Oliva oliva@dcc.unicamp.br
Wed Nov 11 13:58:00 GMT 1998


On Nov 11, 1998, Valentin Bonnard <bonnardv@pratique.fr> wrote:

>> 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 ?

Actually, no.  Overload resolution proceeds as if there were such an
implicit operator, but, in fact, &x has different meanings depending
on whether x provides an operator& or not.  There's no such thing as
implicit generation of operator&.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.anu.edu.au}
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list