From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26899 invoked by alias); 5 Mar 2011 16:38:00 -0000 Received: (qmail 26767 invoked by uid 22791); 5 Mar 2011 16:37:58 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 05 Mar 2011 16:37:54 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PvuUK-0003LF-5V for gcc-help@gcc.gnu.org; Sat, 05 Mar 2011 17:37:52 +0100 Received: from adsl-176-113-110.asm.bellsouth.net ([74.176.113.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Mar 2011 17:37:52 +0100 Received: from eldlistmailingz by adsl-176-113-110.asm.bellsouth.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Mar 2011 17:37:52 +0100 To: gcc-help@gcc.gnu.org From: Edward Diener Subject: Re: Compiler error using 4.5.2 with function template Date: Sat, 05 Mar 2011 16:38:00 -0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00053.txt.bz2 On 3/5/2011 11:17 AM, Edward Diener wrote: > This very simple program: > > template struct ATemplate { }; > template void check(ATemplate<&T::SomeFuncTemplate > *); > > int main() > { > return 0; > } > > produces a compiler error: > > "test_has_mem_fun_template.cpp:2:66: error: template argument 1 is invalid > > "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g > -Wno-variadic-macros -I"..\..\.." > -I"C:\Programming\VersionControl\boost" -c -o > "..\..\..\bin.v2\libs\tti\test\test_has_mem_fun_template.test\gcc-mingw-4.5.2\debug\test_has_mem_fun_template.o" > "test_has_mem_fun_template.cpp"" > > I suspect that I need to add the 'template' keyword to tell the compiler > that SomeFuncTemplate is a function template but all my attempts appear > to fail. > > Is this a compiler bug or do I need to do something else above ? Evidently this works: template struct ATemplate { }; template void check(ATemplate > *); int main() { return 0; }