From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 93A2839724A0; Thu, 7 May 2020 18:12:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93A2839724A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588875141; bh=IdGrdJy/Hb2sDIPooDS8PXpoeD9FEiotk03KTMYtxKQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hO3qYzQ5HqOVD4zd/zB/si0kcHraXShZ8UAPMy/N/TDdQ6BqVExqvEWjJ/GfEwh7i tAMSZLPtRMchsR5tQhdYQ6Q/djjAbQWjEVTooKjWthJNx7kGC/uctQTM98vj1AXG1s CK5pKSUqf2ScjngKT3tf2fGScErhdvKwZ9iMIUdQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94255] template specialization in different namespace causes crash Date: Thu, 07 May 2020 18:12:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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, 07 May 2020 18:12:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94255 --- Comment #7 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:21968d4ae067e3fa1c1728c8db26478e8ac8ad0b commit r11-175-g21968d4ae067e3fa1c1728c8db26478e8ac8ad0b Author: Marek Polacek Date: Fri Apr 17 23:48:11 2020 -0400 c++: Fix crash with template spec in different namespace [PR94255] This is an ICE on invalid, because we're specializing S::foo in the wrong namespace. cp_parser_class_specifier_1 parses S::foo in M and then it tries to push the nested-name-specifier of foo, which is S. By that, we're breaking the assumption of push_inner_scope that the pushed scope must be a scope nested inside current scope: current scope is M, but the namespace context of S is N, and N is not nested in M, so we fell into an infinite loop in push_inner_scope_r. (cp_parser_class_head called check_specialization_namespace which alrea= dy gave a permerror.) PR c++/94255 * parser.c (cp_parser_class_specifier_1): Check that the scope = is nested inside current scope before pushing it. * g++.dg/template/spec41.C: New test.=