This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17056] New: ambiguous function call problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]