This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17056] New: ambiguous function call problem
- From: "emild at collectivestudios dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Aug 2004 02:30:37 -0000
- Subject: [Bug c++/17056] New: ambiguous function call problem
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code should compile with no errors:
template <class T>
void foo( T const & );
template <class T,int S>
void foo( T (&)[S] );
void bar( unsigned char const (&x)[16] )
{
foo(x);
}
G++ incorrectly reports the following errors:
In function `void bar(const unsigned char (&)[16])':
error: call of overloaded `foo(const unsigned char[16])' is ambiguous
error: candidates are: void foo(const T&)
[with T = unsigned char[16]]
error: void foo(T (&)[S])
[with T = const unsigned char, int S = 16]
Both Comeau C++ and VC 7.1 compile the code with no errors. Indeed, an
instantiation of the second foo template with T=unsigned char const and S=16 is
a perfect match for the call.
--
Summary: ambiguous function call problem
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: emild at collectivestudios dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17056