From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11261 invoked by alias); 17 Jan 2008 21:33:57 -0000 Received: (qmail 11253 invoked by uid 22791); 17 Jan 2008 21:33:57 -0000 X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Jan 2008 21:33:28 +0000 Received: by fg-out-1718.google.com with SMTP id d23so771432fga.28 for ; Thu, 17 Jan 2008 13:33:25 -0800 (PST) Received: by 10.82.161.19 with SMTP id j19mr4512773bue.20.1200605605237; Thu, 17 Jan 2008 13:33:25 -0800 (PST) Received: by 10.82.173.1 with HTTP; Thu, 17 Jan 2008 13:33:25 -0800 (PST) Message-ID: <84fc9c000801171333xf405eecxd91c4d43b335af44@mail.gmail.com> Date: Thu, 17 Jan 2008 22:59:00 -0000 From: "Richard Guenther" To: "Ian Lance Taylor" Subject: Re: A simple sample code involving templates, friends and lookup Cc: "Dragan Milenkovic" , gcc@gcc.gnu.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <478F3175.2050809@plusplus.co.yu> <84fc9c000801170449j332abd0bp501bbc2fd9d04c46@mail.gmail.com> <478F544F.9060509@plusplus.co.yu> <84fc9c000801170535k1bd3eb89p6f95d63ee6f58647@mail.gmail.com> <84fc9c000801170911p199d1913i796e92bba9a17cb7@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00281.txt.bz2 On 17 Jan 2008 11:46:52 -0800, Ian Lance Taylor wrote: > > "Richard Guenther" writes: > > > > Well, first I think you'd need friend-injection or otherwise a global > > decl of the function. > > ADL works without friend injection. Look at 3.4.2 > [basic.lookup.koenig] in C++98. I did. It says "other _namespaces_ not considered...". > > Second I thought argument dependent > > name-lookup only applies to namespaces, not classes. > > No. > > > EDG rejects this consistently btw. > > Well, I'm probably misinterpreting the example. Adding the templates > must change it somehow. Well, the actual call to func is not dependent, so it should not affect name-resolution. > For example, this works fine, even without -ffriend-injection: > > class x { friend x operator+(const x& x1, const x& x2); }; > x foo(x x1, x x2) { return x1 + x2; } It does, even with EDG. Well, a language lawyer can probably clear things up. From a look at the std it looks like w/o a previous declaration the above should be invalid. And at a different point it suggests the decl becomes available. Bah. Richard.