public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64063] New: Incorrect "ambiguous template specialization" error
@ 2014-11-24 23:35 redi at gcc dot gnu.org
2014-11-25 0:02 ` [Bug c++/64063] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-24 23:35 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
@ 2014-11-25 0:02 ` redi at gcc dot gnu.org
2014-11-25 2:38 ` [Bug c++/64063] [DR 1665] " redi at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 0:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Apparently EDG instantiates the member function template, which is not what I
wanted:
template<typename T>
struct S
{
void foo(int) { }
template<typename U> void foo(U); // undefined
};
template void S<char>::foo(int); // XXX
"inst.cc", line 8: error: function "S<T>::foo(U) [with T=char, U=int]" cannot
be instantiated -- no template definition was supplied
template void S<char>::foo(int); // XXX
^
Is there no syntax for instantiating the non-template?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] [DR 1665] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
2014-11-25 0:02 ` [Bug c++/64063] " redi at gcc dot gnu.org
@ 2014-11-25 2:38 ` redi at gcc dot gnu.org
2014-11-25 2:43 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 2:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |SUSPENDED
Last reconfirmed| |2014-11-25
Summary|Incorrect "ambiguous |[DR 1665] Incorrect
|template specialization" |"ambiguous template
|error |specialization" error
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
At http://llvm.org/bugs/show_bug.cgi?id=21661 Richard identified this as
http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1665
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] [DR 1665] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 2:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The current handling of the following is still wrong (rejects-valid)
independent of DR 1665. It should compile because it can only refer to the
template:
template<typename T>
struct S
{
void foo(int);
template<typename U> void foo(U) { }
};
template void S<char>::foo<>(int);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] [DR 1665] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-24 18:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 39270.
*** This bug has been marked as a duplicate of bug 39270 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] [DR 1665] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-24 19:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|DUPLICATE |---
Status|RESOLVED |NEW
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reopening.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/64063] [DR 1665] Incorrect "ambiguous template specialization" error
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
` (4 preceding siblings ...)
2022-01-24 19:13 ` pinskia at gcc dot gnu.org
@ 2022-01-24 19:14 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-24 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fchelnokov at gmail dot com
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 104204 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-01-24 19:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 23:35 [Bug c++/64063] New: Incorrect "ambiguous template specialization" error redi at gcc dot gnu.org
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
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).