From patchwork Tue Oct 18 17:37:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 120472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9865DB70DC for ; Wed, 19 Oct 2011 04:38:02 +1100 (EST) Received: (qmail 21269 invoked by alias); 18 Oct 2011 17:37:57 -0000 Received: (qmail 21145 invoked by uid 22791); 18 Oct 2011 17:37:55 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 17:37:38 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9IHbbMh013467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Oct 2011 13:37:37 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9IHbbHx001840 for ; Tue, 18 Oct 2011 13:37:37 -0400 Received: from [0.0.0.0] (ovpn-113-91.phx2.redhat.com [10.3.113.91]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p9IHbZ7l016519 for ; Tue, 18 Oct 2011 13:37:36 -0400 Message-ID: <4E9DB95F.3000903@redhat.com> Date: Tue, 18 Oct 2011 13:37:35 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/50742 (ICE on switch with local using-decl) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org A using-declaration adds a TREE_LIST to the list of names on a binding level, so we need to cope with that here. Tested x86_64-pc-linux-gnu, applying to trunk. commit 052e893fe307f33ca3d3c2ead06248e0ef738f16 Author: Jason Merrill Date: Mon Oct 17 22:04:08 2011 -0400 PR c++/50742 * decl.c (check_previous_goto_1): Handle using-decl. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8b5033f..4b5b6c8 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2683,7 +2683,8 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names, tree new_decls, old_decls = (b == level ? names : NULL_TREE); for (new_decls = b->names; new_decls != old_decls; - new_decls = DECL_CHAIN (new_decls)) + new_decls = (DECL_P (new_decls) ? DECL_CHAIN (new_decls) + : TREE_CHAIN (new_decls))) { int problem = decl_jump_unsafe (new_decls); if (! problem) diff --git a/gcc/testsuite/g++.dg/lookup/using23.C b/gcc/testsuite/g++.dg/lookup/using23.C new file mode 100644 index 0000000..5dd8d85 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using23.C @@ -0,0 +1,13 @@ +// PR c++/50742 + +typedef int A; + +void f(int i) +{ + switch (i) + { + case 0: + using ::A; + default:; + } +}