public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: llewelly@xmission.com
To: gcc-bugzilla@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: [Bug c++/15339] function call error
Date: Fri, 07 May 2004 16:36:00 -0000 [thread overview]
Message-ID: <s3r65b85h4r.fsf@xmission.xmission.com> (raw)
In-Reply-To: <20040507153051.25717.qmail@sources.redhat.com>
"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> ------- Additional Comments From bangerth at dealii dot org 2004-05-07 15:30 -------
> Confirmed, here is a smaller testcase:
> -----------
> template<typename> void fun(int);
> template<typename> void fun(int = 0) {}
>
> int main()
> { fun(); }
> -----------
>
> g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
> x.cc: In function `int main()':
> x.cc:10: error: no matching function for call to `fun()'
>
> However, we get this from icc:
> g/x> icc -Xc -ansi x.cc
> x.cc(2): warning #845: specifying a default argument when redeclaring an
> unreferenced function template is nonstandard
> template<typename> void fun(int = 0) {}
> ^
>
> x.cc(5): error: no instance of function template "fun" matches the argument
> list
> { fun(); }
> ^
>
> compilation aborted for x.cc (code 2)
>
>
> So it seems that this is wrong code. Someone will have to look up the exact
> text in the standard though. I find it odd that this only applies to
> templates, not to non-template functions.
It's in 8.3.6/4 . But see issue 226:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#226
Basicly, it's a leftover from when there was no way to explicitly
specifiy template arguments for function templates.
next prev parent reply other threads:[~2004-05-07 16:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-07 15:03 [Bug c++/15339] New: " MichaelLi8195 at hotmail dot com
2004-05-07 15:30 ` [Bug c++/15339] " bangerth at dealii dot org
2004-05-07 16:36 ` llewelly [this message]
2004-05-07 15:37 ` bangerth at dealii dot org
2004-05-07 16:24 ` Gabriel Dos Reis
2004-05-07 16:24 ` gdr at integrable-solutions dot net
2004-05-07 16:36 ` llewelly at xmission dot com
2004-05-07 16:54 ` bangerth at dealii dot org
2004-05-08 16:29 ` giovannibajo at libero dot it
2004-05-08 16:32 ` [Bug c++/15339] [DR217] Adding default arguments to function templates in redeclartions should be forbidden giovannibajo at libero dot it
2004-05-09 14:19 ` MichaelLi8195 at hotmail dot com
2004-05-09 15:18 ` bangerth at dealii dot org
2004-07-13 20:13 ` giovannibajo at libero dot it
2004-07-13 20:14 ` giovannibajo at libero dot it
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=s3r65b85h4r.fsf@xmission.xmission.com \
--to=llewelly@xmission.com \
--cc=gcc-bugs@gcc.gnu.org \
--cc=gcc-bugzilla@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: link
Be 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).