From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3959A385841B; Thu, 17 Feb 2022 04:55:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3959A385841B From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104578] New: [12 Regression] accepts invalid partial template specialization, non-type template argument depends on a template parameter Date: Thu, 17 Feb 2022 04:55: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: 12.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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 keywords 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2022 04:55:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104578 Bug ID: 104578 Summary: [12 Regression] accepts invalid partial template specialization, non-type template argument depends on a template parameter Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- While looking into PR 104567, I just happened upon some code which is rejec= ted by before GCC 12, MSVC, clang and ICC. I suspect it is invalid code as all other compilers besides the trunk reject it for a similar reasons. Take: template struct s{}; template struct s<_TAny, _TAny::param> { typedef int type; }; struct checked_type { static const int param =3D 0; }; s::type t; int main() { return t; } ----- CUT ---- clang reports: :5:17: error: type of specialized non-type template argument depend= s on a template parameter of the partial specialization struct s<_TAny, _TAny::param> ^~~~~ :14:18: error: no type named 'type' in 's' s::type t; ~~~~~~~~~~~~~~~~~^ MSVC reports: (8): error C2753: 's<_TAny,_TAny::param>': partial specialization cannot match argument list for primary template ICC reports: (5): error: the template argument list of the partial specialization includes a nontype argument whose type depends on a template parameter struct s<_TAny, _TAny::param> ^ GCC 11.2.0 reports: :5:8: error: template argument '_TAny::param' involves template parameter(s) 5 | struct s<_TAny, _TAny::param> | ^~~~~~~~~~~~~~~~~~~~~~ GCC 12 accepts this for all levels of the C++ standard.=