Operator name lookup

Gabriel Dos Reis gdr@integrable-solutions.net
Sat Sep 21 02:34:00 GMT 2002


Mark Mitchell <mark@codesourcery.com> writes:

| G++ presently accepts this code:
| 
|   typedef int B;
|   struct A
|   {
|     int B;
|     operator B *();
|   };
| 
| EDG and the new parser agree -- this is invalid.  (In particular, the
| "B" in "operator B*" refers to "A::B", not "::B".)
| 
| I do not find anything in the standard that justifies G++'s present
| interpretation.

G++'s current behaviour is bogus -- as is usual when it comes to name
lookup :-(.  Ordinary name lookup finds A::B and stops.

[...]

| Therefore, I will not try to add support for this
| extension to the new parser, and I will add an appropriate NEWS entry.
| 
| Comments?

I'm not convinced that was a feature :-) :-)  Please just ditch it.

-- Gaby



More information about the Gcc-patches mailing list