From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29050 invoked by alias); 21 Jan 2010 18:38:56 -0000 Received: (qmail 28982 invoked by uid 48); 21 Jan 2010 18:38:34 -0000 Date: Thu, 21 Jan 2010 18:38:00 -0000 Message-ID: <20100121183834.28981.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/5458] address of overloaded template function as argument for template In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "joseph dot h dot garvin at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-01/txt/msg02643.txt.bz2 ------- Comment #15 from joseph dot h dot garvin at gmail dot com 2010-01-21 18:38 ------- I'm not sure what the standard says, but conceptually, if you only provide a template generic template foo, with no non-templated foo defined, then instantiations of foo are *never* 'overloaded.' If I have: template void foo() {} Then foo<3> is a distinct function from foo<2>. It doesn't make sense to refer to foo as overloaded (unless there is also a non-templated foo defined). foo<3> has a single unique address, there is no ambiguity. Automatically considering it an overloaded function (as I suspect GCC must be doing internally) leads to a confusing error when compiling this snippet: #include template void foo() {} int main() { &foo; } You get the same error about not being able to resolve foo because it's overloaded. But foo isn't a function at this point. It's a template. And no template parameters have been filled in. I should get an error about expecting angle brackets. -- joseph dot h dot garvin at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joseph dot h dot garvin at | |gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458