public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template
@ 2014-03-27 1:48 filip.roseen at gmail dot com
2014-12-14 16:29 ` [Bug c++/60679] " ville.voutilainen at gmail dot com
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: filip.roseen at gmail dot com @ 2014-03-27 1:48 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5290 bytes --]
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Bug ID: 60679
Summary: class specialization not instantiated even though it
is a better match than the primary template
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32463
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32463&action=edit
testcase.cpp
template<int...> struct A { }; // (A)
template<char X, char Y>
struct A<X, Y> { typedef int type; }; // (B)
int main () {
(void) A<0, 0>::type { };
}
-------------------------------------------------------------------------------
testcase.cpp: In function âint main()â:
testcase.cpp:7:10: error: âtypeâ is not a member of âA<0, 0>â
(void) A<0, 0>::type { };
^
-------------------------------------------------------------------------------
Note: `clang` correctly accepts `testcase.cpp`.
-------------------------------------------------------------------------------
This is how it should look, but gcc fails on step 4);
1. first our primary template `(A)` is looked up, and our template
arguments are deduced from those specified for this primary template
2. we then look for specializations, `(B)` should be found
3. `(B)` is more specialized than our primary template, proceed
4. `(B)` should be selected if no narrowing-conversion applies to
instantiating it, which is true; `int { 0 }` fits inside `char`
Note: A non-narrowing conversion can be proved since `0` is a
constant-expression and can fit inside `char`, see
[dcl.init.list]p7
5. `(B)` is the best candidate, instantiate it
-------------------------------------------------------------------------------
[temp.class.spec.match]p4:
> The templates arguments of a specializaton are deduced from the arguments
> of the primary template.
[temp.class.spec]p6 states the following:
> Partial specializations declarations themselves are not found by name
> lookup. Rather, when the primary template name is used, any
> previously-declared partial specializations of the primary template
> are also considered.
-------------------------------------------------------------------------------
>From gcc-bugs-return-447621-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Mar 27 01:59:44 2014
Return-Path: <gcc-bugs-return-447621-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26965 invoked by alias); 27 Mar 2014 01:59:43 -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 26930 invoked by uid 48); 27 Mar 2014 01:59:38 -0000
From: "filip.roseen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60680] New: unqalified-id expected, gcc fails to diagnose and accepts invalid
Date: Thu, 27 Mar 2014 01:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: filip.roseen at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
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_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-60680-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-03/txt/msg02490.txt.bz2
Content-length: 968
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`680
Bug ID: 60680
Summary: unqalified-id expected, gcc fails to diagnose and
accepts invalid
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32464
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id2464&actioníit
testcase.cpp
int main () {
int(*) = 0;
}
----------------------------------------------------------------------------------
The above compiles but the above is not legal according to any section of the
Standard. `clang` correctly throws out a diagnostic saying that the line in
question is ill-formed.
There are many variations on the above that gcc happily accepts, such as:
`auto(*)(int) = 0`, `auto(*)() = 0`, etc, etc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
@ 2014-12-14 16:29 ` ville.voutilainen at gmail dot com
2022-01-07 4:41 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 16:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1, 5.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
2014-12-14 16:29 ` [Bug c++/60679] " ville.voutilainen at gmail dot com
@ 2022-01-07 4:41 ` pinskia at gcc dot gnu.org
2022-01-07 4:50 ` [Bug c++/60679] [DR1647] " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 4:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |SUSPENDED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
yes it does look like that CWG which is still active so suspending.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] [DR1647] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
2014-12-14 16:29 ` [Bug c++/60679] " ville.voutilainen at gmail dot com
2022-01-07 4:41 ` pinskia at gcc dot gnu.org
@ 2022-01-07 4:50 ` pinskia at gcc dot gnu.org
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 4:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1647
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] [DR1647] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
` (2 preceding siblings ...)
2022-01-07 4:50 ` [Bug c++/60679] [DR1647] " pinskia at gcc dot gnu.org
@ 2022-01-07 4:51 ` pinskia at gcc dot gnu.org
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 4:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ghabriel.nunes at hotmail dot com
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 87108 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] [DR1647] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
` (3 preceding siblings ...)
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
@ 2022-01-07 4:51 ` pinskia at gcc dot gnu.org
2022-01-15 19:02 ` ppalka at gcc dot gnu.org
2024-03-18 13:38 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 4:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ray@klipp-lischner.net
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 83426 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] [DR1647] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
` (4 preceding siblings ...)
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
@ 2022-01-15 19:02 ` ppalka at gcc dot gnu.org
2024-03-18 13:38 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-15 19:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fchelnokov at gmail dot com
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 104043 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/60679] [DR1647] class specialization not instantiated even though it is a better match than the primary template
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
` (5 preceding siblings ...)
2022-01-15 19:02 ` ppalka at gcc dot gnu.org
@ 2024-03-18 13:38 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-18 13:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60679
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hokein.wu at gmail dot com
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 114378 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-03-18 13:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 1:48 [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template filip.roseen at gmail dot com
2014-12-14 16:29 ` [Bug c++/60679] " ville.voutilainen at gmail dot com
2022-01-07 4:41 ` pinskia at gcc dot gnu.org
2022-01-07 4:50 ` [Bug c++/60679] [DR1647] " pinskia at gcc dot gnu.org
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
2022-01-07 4:51 ` pinskia at gcc dot gnu.org
2022-01-15 19:02 ` ppalka at gcc dot gnu.org
2024-03-18 13:38 ` ppalka 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).