From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8239 invoked by alias); 17 Aug 2004 02:30:38 -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 8169 invoked by uid 48); 17 Aug 2004 02:30:37 -0000 Date: Tue, 17 Aug 2004 02:30:00 -0000 From: "emild at collectivestudios dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040817023036.17056.emild@collectivestudios.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17056] New: ambiguous function call problem X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01601.txt.bz2 List-Id: The following code should compile with no errors: template void foo( T const & ); template 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