This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11540] New: Redefinition of default arguments allowed for template functions
- From: "philippe dot haution at mines-paris dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2003 08:13:11 -0000
- Subject: [Bug c++/11540] New: Redefinition of default arguments allowed for template functions
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11540
Summary: Redefinition of default arguments allowed for template
functions
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe dot haution at mines-paris dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The following code is deemed legal by gcc, although it breaks the one definition
per translation unit rule :
testcase.cc :
-----------------------
namespace ns
{
template<typename Tv>
int convert_from_v(Tv v, int prec = -1)
{ return 1; }
}
namespace ns
{
template<typename Tv>
int convert_from_v(Tv v, int prec = -2);
}
int main()
{
return ns::convert_from_v<int>(1);
}
$ g++ testcase.cc -o testcase
$ testcase
$ echo $?
255