From patchwork Thu Mar 29 15:50:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 149424 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 692FCB6EEF for ; Fri, 30 Mar 2012 02:51:21 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1333641082; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=kw/3bDv G6zC4LlemgVGYtIIClIU=; b=symxUsyhoWPhzJBY4AgKzmsCxqylTHfmFwnFTEq k2fzQIvNNLS45TEDr3yNdfn4LyHlZGoqFmdn7MGDUNHVjXidGntWN+YXtzKSMz45 3CpDEAWt1bJQgs4XYcRLvYMQpc5YkZ0X7XyHowUTF8FgQ0kn7sL0jahRFNhT6J2g gI0U= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=aRLg/+pJtfE3YUTmvTSL+B0iqqohM5Fq0yhvYWas595gwLWfJ2bvct+aaqPyLA 3gWtxqiKetBuy+piLdiLVrV+Za63rvw+qIKwd2RSPoBLhw49JOUs79qHVfu2XfJ/ y0wKb3SWVwOCyW6/AhJ43R8Qc6w4I4bG1pe9fin4Bf4SA=; Received: (qmail 21713 invoked by alias); 29 Mar 2012 15:51:13 -0000 Received: (qmail 21692 invoked by uid 22791); 29 Mar 2012 15:51:11 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Thu, 29 Mar 2012 15:50:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2TFotIY023867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Mar 2012 11:50:55 -0400 Received: from [10.3.113.47] (ovpn-113-47.phx2.redhat.com [10.3.113.47]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2TFosQP001857 for ; Thu, 29 Mar 2012 11:50:55 -0400 Message-ID: <4F7484DE.6050804@redhat.com> Date: Thu, 29 Mar 2012 11:50:54 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/52685 (ICE with dependent/non-dependent bases) 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 In this testcase, C has a base B which is a non-dependent scope because it is the current instantiation. But B has a dependent base A>, so we need to be able to handle a non-dependent base that itself has a dependent base. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit f44bf02aa21ddfd33505c067f3c26893d432a186 Author: Jason Merrill Date: Thu Mar 29 11:08:11 2012 -0400 PR c++/52685 * tree.c (copy_binfo): Handle BINFO_DEPENDENT_BASE_P. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 87e9be8..30ad5e1 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1237,12 +1237,11 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) TREE_CHAIN (*igo_prev) = new_binfo; *igo_prev = new_binfo; - if (binfo) + if (binfo && !BINFO_DEPENDENT_BASE_P (binfo)) { int ix; tree base_binfo; - gcc_assert (!BINFO_DEPENDENT_BASE_P (binfo)); gcc_assert (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), type)); BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo); @@ -1255,8 +1254,6 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++) { tree new_base_binfo; - - gcc_assert (!BINFO_DEPENDENT_BASE_P (base_binfo)); new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo), t, igo_prev, BINFO_VIRTUAL_P (base_binfo)); diff --git a/gcc/testsuite/g++.dg/template/inherit8.C b/gcc/testsuite/g++.dg/template/inherit8.C new file mode 100644 index 0000000..a9b2bdb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/inherit8.C @@ -0,0 +1,13 @@ +// PR c++/52685 + +template +struct A +{ + template + struct B : public A > + { + struct C : public B + { + }; + }; +};