From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18703 invoked by alias); 17 Jan 2008 13:10:32 -0000 Received: (qmail 18695 invoked by uid 22791); 17 Jan 2008 13:10:32 -0000 X-Spam-Check-By: sourceware.org Received: from plusplus.gw.tehnicom.net (HELO leon.plusplus.co.yu) (62.193.142.214) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 Jan 2008 13:10:12 +0000 Received: from [192.168.11.8] (adsl-ppp-0251.yubc.net [212.124.170.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by leon.plusplus.co.yu (Postfix) with ESMTP id E3E787B858; Thu, 17 Jan 2008 14:09:59 +0100 (CET) Message-ID: <478F544F.9060509@plusplus.co.yu> Date: Thu, 17 Jan 2008 13:24:00 -0000 From: Dragan Milenkovic User-Agent: Thunderbird 1.5.0.10 (X11/20070306) MIME-Version: 1.0 To: Richard Guenther Cc: gcc@gcc.gnu.org Subject: Re: A simple sample code involving templates, friends and lookup References: <478F3175.2050809@plusplus.co.yu> <84fc9c000801170449j332abd0bp501bbc2fd9d04c46@mail.gmail.com> In-Reply-To: <84fc9c000801170449j332abd0bp501bbc2fd9d04c46@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00262.txt.bz2 Richard Guenther wrote: [snip] >> template >> struct Foo >> { >> template >> friend void func(const Foo &); >> }; >> >> void check(const Foo & x) >> { >> // Foo weird; // uncomment this line and all works >> >> func(x); // <-- ERROR >> } >> >> >> Tested with gcc 4.0 - 4.3, and all behave the same: >> >> "error: 'func' was not declared in this scope" >> >> but it works if you uncomment the weird line. > > Actually even with the weird line the program is invalid. What are > you trying to do? ;) > > Richard. Ok... afaik, that func should be defined on that very place where it is declared as friend. But could you please elaborate why it is invalid, since you made me start questioning my C++ knowledge... :-D Dragan