From mboxrd@z Thu Jan 1 00:00:00 1970 From: bourguet@cadence.com To: gcc-gnats@gcc.gnu.org Cc: Gabriel Dos Reis Subject: c++/3115: g++ find a friend operator while it should not Date: Mon, 11 Jun 2001 01:26:00 -0000 Message-id: <20010611081836.29094.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00393.html List-Id: >Number: 3115 >Category: c++ >Synopsis: g++ find a friend operator while it should not >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jun 11 01:26:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: bourguet@cadence.com >Release: Current snapshot at code sourcery >Organization: >Environment: >Description: The appended code compile while it should not. The operator+ is in the lexical scope of additive_group_sig (11.4.5) and so should be found only using argument dependent name lookup. template struct additive_group_sig { friend T operator+(const T& u, const T& v) { T t(u); t += v; return t; } }; class Integer { public: Integer& operator+=(const Integer&); private: additive_group_sig x; }; int main() { Integer d, e, f; f = e + d; } >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: