public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "emild at collectivestudios dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/17056] New: ambiguous function call problem
Date: Tue, 17 Aug 2004 02:30:00 -0000	[thread overview]
Message-ID: <20040817023036.17056.emild@collectivestudios.com> (raw)

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


             reply	other threads:[~2004-08-17  2:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-17  2:30 emild at collectivestudios dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040817023036.17056.emild@collectivestudios.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).