This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13652] New: GCC gives spurious error for template function overloaded on return type.
- From: "gprentice at paradise dot net dot nz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jan 2004 06:57:24 -0000
- Subject: [Bug c++/13652] New: GCC gives spurious error for template function overloaded on return type.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC fails to compile this valid code. As per 14.5.5.1/4 a template function
can be overloaded on the return type. GCC says #2 ambiguates #1.
VC7.1, Comeau and BCC5.5.1 all accept the code. See also active issue 271.
Thanks to Rani Sharoni for pointing this out.
template<typename T> long* f(T, char); // #1
template<typename T> char* f(T, char); // #2
int main()
{
typedef char* (*fp1)(int, char);
fp1 x1 = f;
x1(3,4);
}
--
Summary: GCC gives spurious error for template function
overloaded on return type.
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gprentice at paradise dot net dot nz
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13652