public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64063] New: Incorrect "ambiguous template specialization" error
Date: Mon, 24 Nov 2014 23:35:00 -0000	[thread overview]
Message-ID: <bug-64063-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063

            Bug ID: 64063
           Summary: Incorrect "ambiguous template specialization" error
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

G++ rejects this explicit instantiation definition as ambiguous:

template<typename T>
struct S
{
  void foo(int) { }
  template<typename U> void foo(U) { }
};

template void S<char>::foo(int);  // XXX


EDG thinks it's OK, clang crashes, and G++ says:


inst.cc:8:15: error: ambiguous template specialization ‘foo<>’ for ‘void
S<char>::foo(int)’
 template void S<char>::foo(int);  // XXX
               ^
inst.cc:4:8: note: candidates are: void S<T>::foo(int) [with T = char]
   void foo(int) { }
        ^
inst.cc:5:29: note:                 template<class U> void S<T>::foo(U) [with U
= U; T = char]
   template<typename U> void foo(U) { }
                             ^


I think EDG is correct and the diagnostic is wrong, because I'm not referring
to any foo<> but rather foo.


Changing the instantiation to be unambiguously a template produces almost the
same error (with foo<> replaced by foo<int>) and that definitely isn't
ambiguous because one candidate isn't even a function template:

template<typename T>
struct S
{
  void foo(int) { }
  template<typename U> void foo(U) { }
};

template void S<char>::foo<int>(int);  // XXX


inst.cc:8:15: error: ambiguous template specialization ‘foo<int>’ for ‘void
S<char>::foo(int)’
 template void S<char>::foo<int>(int);  // XXX
               ^
inst.cc:4:8: note: candidates are: void S<T>::foo(int) [with T = char]
   void foo(int) { }
        ^
inst.cc:5:29: note:                 template<class U> void S<T>::foo(U) [with U
= U; T = char]
   template<typename U> void foo(U) { }
                             ^
>From gcc-bugs-return-468449-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Nov 24 23:38:12 2014
Return-Path: <gcc-bugs-return-468449-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11594 invoked by alias); 24 Nov 2014 23:38:12 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11566 invoked by uid 48); 24 Nov 2014 23:38:09 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/64057] Overlapping memcpy generated for array assignment
Date: Mon, 24 Nov 2014 23:38:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-64057-4-KS74Lj1BGn@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64057-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64057-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-11/txt/msg02921.txt.bz2
Content-length: 691

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd057

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-11-24
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Let me know if you need more info

We need a testcase that fails with GCC 4.8 or GCC 4.9 since xsinfo is built by
the base compiler.


             reply	other threads:[~2014-11-24 23:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 23:35 redi at gcc dot gnu.org [this message]
2014-11-25  0:02 ` [Bug c++/64063] " redi at gcc dot gnu.org
2014-11-25  2:38 ` [Bug c++/64063] [DR 1665] " redi at gcc dot gnu.org
2014-11-25  2:43 ` redi at gcc dot gnu.org
2022-01-24 18:19 ` pinskia at gcc dot gnu.org
2022-01-24 19:13 ` pinskia at gcc dot gnu.org
2022-01-24 19:14 ` pinskia at gcc dot gnu.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=bug-64063-4@http.gcc.gnu.org/bugzilla/ \
    --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).