public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17056] New: ambiguous function call problem
@ 2004-08-17  2:30 emild at collectivestudios dot com
  2004-08-17  3:13 ` [Bug c++/17056] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: emild at collectivestudios dot com @ 2004-08-17  2:30 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-28  5:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-17  2:30 [Bug c++/17056] New: ambiguous function call problem emild at collectivestudios dot com
2004-08-17  3:13 ` [Bug c++/17056] " pinskia at gcc dot gnu dot org
2004-08-18 15:33 ` [Bug c++/17056] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-18 22:06 ` oliverst at online dot de
2004-08-18 22:51 ` bangerth at dealii dot org
2004-08-29 18:43 ` mmitchel at gcc dot gnu dot org
2004-10-28  5:40 ` [Bug c++/17056] [3.3/3.4/4.0 " mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).