From patchwork Fri Mar 4 16:33:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 85424 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 0B8F4B70F9 for ; Sat, 5 Mar 2011 03:34:12 +1100 (EST) Received: (qmail 12633 invoked by alias); 4 Mar 2011 16:34:07 -0000 Received: (qmail 12543 invoked by uid 22791); 4 Mar 2011 16:34:06 -0000 X-SWARE-Spam-Status: No, hits=-6.2 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; Fri, 04 Mar 2011 16:33:58 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p24GXuwL009952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Mar 2011 11:33:56 -0500 Received: from [127.0.0.1] (ovpn-113-31.phx2.redhat.com [10.3.113.31]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p24GXtGb030722 for ; Fri, 4 Mar 2011 11:33:56 -0500 Message-ID: <4D711473.1000300@redhat.com> Date: Fri, 04 Mar 2011 11:33:55 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/47971 (ICE with pseudo-dtor call in template) 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 Another case of wrongly treating a type as an expression. I've also changed tsubst_copy to only abort when this happens in checking mode; simply returning the argument worked OK in previous releases. Tested x86_64-pc-linux-gnu, applied to trunk. commit 45546accfd674ac13c8a469c616f1abcfb96743a Author: Jason Merrill Date: Thu Mar 3 18:52:23 2011 -0500 PR c++/47971 * pt.c (tsubst_copy_and_build) [PSEUDO_DTOR_EXPR]: Use tsubst for type. (tsubst_copy) [default]: Just return t if !ENABLE_CHECKING. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 60b2699..453f1bd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11722,7 +11722,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) return t; default: - gcc_unreachable (); + /* We shouldn't get here, but keep going if !ENABLE_CHECKING. */ + gcc_checking_assert (false); + return t; } } @@ -12979,7 +12981,7 @@ tsubst_copy_and_build (tree t, return finish_pseudo_destructor_expr (RECUR (TREE_OPERAND (t, 0)), RECUR (TREE_OPERAND (t, 1)), - RECUR (TREE_OPERAND (t, 2))); + tsubst (TREE_OPERAND (t, 2), args, complain, in_decl)); case TREE_LIST: { diff --git a/gcc/testsuite/g++.dg/template/pseudodtor6.C b/gcc/testsuite/g++.dg/template/pseudodtor6.C new file mode 100644 index 0000000..4438b6f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pseudodtor6.C @@ -0,0 +1,9 @@ +// PR c++/47971 + +template struct S +{ + typedef double T; + S () { T ().~T (); } +}; + +S s;