Bogus name lookup by overloaded operators

Leonid A. Broukhis leob@mailcom.com
Fri Mar 10 16:13:00 GMT 2000


For context, see http://gcc.gnu.org/ml/gcc-bugs/2000-03/msg00440.html

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

class Dereferenceable {
public:
   void operator* () const;
};

class Multipliable {
public:
   void operator* (Multipliable &) const;
};

class Addable {
public:
   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?

	Leo



More information about the Gcc-bugs mailing list