From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27226 invoked by alias); 27 Mar 2014 01:48:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26998 invoked by uid 48); 27 Mar 2014 01:47:31 -0000 From: "filip.roseen at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60679] New: class specialization not instantiated even though it is a better match than the primary template Date: Thu, 27 Mar 2014 01:48: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: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-03/txt/msg02489.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60679 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=3D32463&action=3Dedit testcase.cpp template struct A { }; // (A) template struct A { typedef int type; }; // (B) int main () { (void) A<0, 0>::type { }; } ---------------------------------------------------------------------------= ---- testcase.cpp: In function =E2=80=98int main()=E2=80=99: testcase.cpp:7:10: error: =E2=80=98type=E2=80=99 is not a member of =E2=80= =98A<0, 0>=E2=80=99 (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 argumen= ts > 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: 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: List-Archive: List-Post: List-Help: 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" 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: 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=60680 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?id=32464&action=edit 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.