public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "joseph dot h dot garvin at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/5458] address of overloaded template function as argument for template Date: Thu, 21 Jan 2010 18:38:00 -0000 [thread overview] Message-ID: <20100121183834.28981.qmail@sourceware.org> (raw) In-Reply-To: <bug-5458-2793@http.gcc.gnu.org/bugzilla/> ------- 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<int n> 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 <iostream> template<int n> 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
next prev parent reply other threads:[~2010-01-21 18:38 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/> 2006-08-21 17:13 ` pinskia at gcc dot gnu dot org 2006-10-09 14:16 ` v dot haisman at sh dot cvut dot cz 2007-08-06 13:59 ` pinskia at gcc dot gnu dot org 2007-08-06 14:19 ` rodolfo at rodsoft dot org 2008-01-07 21:45 ` v dot haisman at sh dot cvut dot cz 2009-11-25 2:55 ` jason at gcc dot gnu dot org 2010-01-21 18:38 ` joseph dot h dot garvin at gmail dot com [this message] 2010-01-21 19:00 ` jwakely dot gcc at gmail dot com 2010-01-21 19:09 ` jason at gcc dot gnu dot org [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu> 2004-01-31 19:07 ` pinskia at gcc dot gnu dot org 2004-01-31 19:08 ` pinskia at gcc dot gnu dot org 2004-05-16 22:27 ` pinskia at gcc dot gnu dot org 2004-08-18 2:23 ` pinskia at gcc dot gnu dot org 2004-08-18 12:58 ` bangerth at dealii dot org 2004-08-27 13:27 ` bangerth at dealii dot org 2004-09-26 20:56 ` pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100121183834.28981.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).