This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FWD: How to reuse a friend operator?


Nathan Sidwell wrote:

> [3.4.1]/9 gives the lookup rules for friends defined in a class. It says
> that lookup shall proceed as described for lookup in member function
> definitions.  So in operator+(const char, const X&); we look in X first
and
> find X::operator+(int);

And the three mentioned compilers do it as you described above.
However, if we add an explicit qualifier to the operator name, GPP
accepts it with no problem, but Comeau and Visual reject the code
(because of different reasons, by the way...). So which compiler is
right (if any)?

    Best regards
    Piotr Wyderski






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]