From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6E6593858C32; Thu, 11 Apr 2024 14:21:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E6593858C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712845296; bh=COIk4unT46KGlhjjKV0kB8JF8GeQCgXWXJQ+6oQrtKo=; h=From:To:Subject:Date:From; b=qBnySHHTxWCh6xJnGw9nzl689hXnZjt9Qw883TbsTcetFQDUDzRVWYkSsj1emg1FA Sl78X/pCcl5v7oURkeukgVqeSungcE9msili64gS+dt2gfQfn49xWeSKJtfUHhCL3F S1BEsq4PymVdC/26Yi9wiDECapL52pS5OMHPlBX0= From: "ing.russomauro at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114694] New: dependent-name alias type accepted in elaborated type specifier within a template Date: Thu, 11 Apr 2024 14:21:34 +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: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ing.russomauro at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114694 Bug ID: 114694 Summary: dependent-name alias type accepted in elaborated type specifier within a template Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ing.russomauro at gmail dot com Target Milestone: --- Here below you may find an example with a class named D, defining a nested alias type which, in turn, is referred by an elaborated type specifier with= in a function template f() instantiated with template type parameter equal to D. The same with a class E where 'using' syntax is used. In both cases, the alias-id is accepted. The non-dependent alias-id ('Alias') is correctly refused. The standard reads "If a typedef-name is used to identify the subject of an elaborated-type-specifier ..., the program is ill-formed." I see old tickets about elaborated-type-specifiers, as 11036, and 87781, an= d a single open ticket 55809, but none of them seem related to the context of a dependent-name alias within a template. class C{public: void f(){};}; using Alias =3D C; struct D { typedef C Alias2; }; struct E { using Alias2 =3D C; }; template void f() { //struct Alias x; -> error, as 'Alias' is an alias type struct T::Alias2 y; // WEIRDLY, no error here, despite 'Alias2' is // an alias type when instantiated with either T= =3DD or T=3DE. y.f(); // avoids warning for unused variable typename T::Alias2 z; // ok no error with typename z.f(); // avoids warning for unused variable } void foo() { //struct Alias a; -> error, as 'Alias' is an alias type //struct D::Alias2 a2; -> error, as 'D::Alias2' is an alias type f(); f(); } int main(){ foo(); }=