From patchwork Fri Jun 24 02:18:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 101712 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 4EC83B6F86 for ; Fri, 24 Jun 2011 12:19:05 +1000 (EST) Received: (qmail 9690 invoked by alias); 24 Jun 2011 02:19:03 -0000 Received: (qmail 9679 invoked by uid 22791); 24 Jun 2011 02:19:02 -0000 X-SWARE-Spam-Status: No, hits=-6.4 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, 24 Jun 2011 02:18:44 +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 p5O2Ih12001684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Jun 2011 22:18:43 -0400 Received: from [127.0.0.1] (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5O2IgRW017861; Thu, 23 Jun 2011 22:18:43 -0400 Message-ID: <4E03F401.7060106@redhat.com> Date: Thu, 23 Jun 2011 22:18:41 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: "H.J. Lu" CC: gcc-patches List Subject: Re: C++ PATCH for c++/49418 (lost cv-quals on template parameter type) References: <4E00EAE6.8090709@redhat.com> In-Reply-To: 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 On 06/23/2011 08:45 PM, H.J. Lu wrote: > This caused: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519 I'm checking this in as an alternate fix. Testing hasn't completed yet, but I'm confident that this version is safe. commit 9084174e504fed2e454948c24144e2a93fabdad2 Author: Jason Merrill Date: Thu Jun 23 22:07:43 2011 -0400 PR c++/49418 * typeck2.c (build_functional_cast): Strip cv-quals for value init. * init.c (build_zero_init_1): Not here. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 62b68f2..3c347a4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -176,7 +176,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p, initialized are initialized to zero. */ ; else if (SCALAR_TYPE_P (type)) - init = convert (cv_unqualified (type), integer_zero_node); + init = convert (type, integer_zero_node); else if (CLASS_TYPE_P (type)) { tree field; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index ff2949c..8bb938e 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1641,7 +1641,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain) { if (VOID_TYPE_P (type)) return void_zero_node; - return build_value_init (type, complain); + return build_value_init (cv_unqualified (type), complain); } /* This must build a C cast. */