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?


Piotr Wyderski wrote:
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)?
[11.4]/5 would seem to indicate g++ is correct.  The DRs of friend
lookup do not seem applicable to this case.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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