From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11961 invoked by alias); 7 May 2004 16:36:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11934 invoked by alias); 7 May 2004 16:36:27 -0000 Date: Fri, 07 May 2004 16:36:00 -0000 Message-ID: <20040507163627.11933.qmail@sources.redhat.com> From: "llewelly at xmission dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040507150259.15339.MichaelLi8195@hotmail.com> References: <20040507150259.15339.MichaelLi8195@hotmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/15339] function call error X-Bugzilla-Reason: CC X-SW-Source: 2004-05/txt/msg00741.txt.bz2 List-Id: ------- Additional Comments From llewelly at xmission dot com 2004-05-07 16:36 ------- Subject: Re: function call error "bangerth at dealii dot org" writes: > ------- Additional Comments From bangerth at dealii dot org 2004-05-07 15:30 ------- > Confirmed, here is a smaller testcase: > ----------- > template void fun(int); > template 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 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. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15339