Bogus name lookup by overloaded operators

Leonid A. Broukhis
Fri Mar 10 16:13:00 GMT 2000

For context, see

Then, if gcc's implementation of the rules is correct, out of the following:

class Dereferenceable {
   void operator* () const;

class Multipliable {
   void operator* (Multipliable &) const;

class Addable {
   void operator+(Addable &) const;

class DerefMultipliable : public Dereferenceable, public Multipliable { };
class DerefAddable : public Dereferenceable, public Addable { };

DerefAddable is perfectly fine, but DerefMultipliable is useless
_just because_ the symbol for multiplication (a binary op) is the same
as for dereferencing (a unary op).  Is it me, or somebody in the ANSI
committee was not feeling well, to put it mildly?

And speaking of the original example: Why care about ambiguity if none of
the candidates comprising the ambiguity is a match?


More information about the Gcc-bugs mailing list