From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 778 invoked by alias); 18 Jan 2008 01:14:05 -0000 Received: (qmail 770 invoked by uid 22791); 18 Jan 2008 01:14:05 -0000 X-Spam-Check-By: sourceware.org Received: from wa-out-1112.google.com (HELO wa-out-1112.google.com) (209.85.146.182) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 18 Jan 2008 01:13:35 +0000 Received: by wa-out-1112.google.com with SMTP id m16so1424133waf.20 for ; Thu, 17 Jan 2008 17:13:33 -0800 (PST) Received: by 10.114.88.1 with SMTP id l1mr409176wab.79.1200618813055; Thu, 17 Jan 2008 17:13:33 -0800 (PST) Received: by 10.114.144.5 with HTTP; Thu, 17 Jan 2008 17:13:32 -0800 (PST) Message-ID: <4348dea50801171713o61db948cu698b97fba1faaab2@mail.gmail.com> Date: Fri, 18 Jan 2008 07:10:00 -0000 From: "Jonathan Wakely" To: "Richard Guenther" Subject: Re: A simple sample code involving templates, friends and lookup Cc: "Ian Lance Taylor" , "Dragan Milenkovic" , gcc@gcc.gnu.org In-Reply-To: <84fc9c000801171333xf405eecxd91c4d43b335af44@mail.gmail.com> 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> <84fc9c000801171333xf405eecxd91c4d43b335af44@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/msg00287.txt.bz2 On 17/01/2008, Richard Guenther wrote: > > 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. Yes, at the point of instantiation of Foo the friend is declared, and can then be found by ADL because Foo is an associated type. The reference parameter 'x' doesn't cause an instantiation, only 'weird' does. However, see the discussion in section 9.2.2 of Vandevoorde and Josuttis' C++ Templates book and the footnote saying the standard isn't exactly clear. I'm only guessing, but EDG's behaviour could be related to their interpretation of DR329 http://www.open-std.org/jtc1/sc22/wg21//docs/cwg_defects.html#329 I'm not sure which interpretation is correct, but GCC's seems reasonable to me. Jon