From patchwork Thu Aug 1 12:25:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 264421 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id AB5A62C0091 for ; Sat, 3 Aug 2013 23:29:58 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=vJAOjVl29advgEjlh493yUz75oiJrGds/Tu7vJ0quvJUSsGrL9CUr WU2fXtmlMkWMlSNp3Y7HenP5jU51N/7qUbMrNAjo/xgNBSA/YXP182Klu1ng7jM1 6ttBJ6GTH6HsVYBu0ZoCUneQWaJU6Yv9tXoeVq2H3tAjm0X2GVgvcw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=hXS1UadQOwniLkEjV6Djj/OEwWI=; b=ohgWscpa6bejpu2mgMmv W35kNT2rvOP2znKRMZ7a0AcO8eyxJiZgZxu1ci771ntPVk7CDAg/o21mpWCl9tmH LKSm5IS7YuIHniQli5cln3qG6gAX1T0YKKgc+8RrUj4IZPWJeYp20ZiJL4g7Rfd5 PGHdylRE45VNiz62HGYF7P8= Received: (qmail 9413 invoked by alias); 3 Aug 2013 13:29:39 -0000 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 Received: (qmail 9368 invoked by uid 89); 3 Aug 2013 13:29:39 -0000 X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 03 Aug 2013 13:29:38 +0000 Received: by mail-wi0-f173.google.com with SMTP id en1so274532wid.0 for ; Sat, 03 Aug 2013 06:29:30 -0700 (PDT) X-Received: by 10.180.160.165 with SMTP id xl5mr1776011wib.46.1375536570441; Sat, 03 Aug 2013 06:29:30 -0700 (PDT) Received: from archbang.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id z2sm9436380wiv.11.2013.08.03.06.29.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 Aug 2013 06:29:29 -0700 (PDT) From: Adam Butcher To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Gabriel Dos Reis , Andrew Sutton , Adam Butcher Subject: [PATCH 1/4] [lambda] Preserve type qualifiers for implicit template parameters. Date: Thu, 1 Aug 2013 13:25:27 +0100 Message-Id: <1375359930-12871-2-git-send-email-adam@jessamine.co.uk> In-Reply-To: <1375359930-12871-1-git-send-email-adam@jessamine.co.uk> References: <51E96FB9.6090108@redhat.com> <1375359930-12871-1-git-send-email-adam@jessamine.co.uk> --- gcc/cp/pt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index dea1ec0..6e209f8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21317,8 +21317,15 @@ add_implicit_template_parms (size_t count, tree parameters) // Rewrite the type of P to be the template_parm added above (getdecls is // used to retrieve it since it is the most recent declaration in this - // scope). - TREE_TYPE (generic_type_ptr) = TREE_TYPE (getdecls ()); + // scope). Qualifiers need to be preserved also. + + tree& cur_type = TREE_TYPE (generic_type_ptr); + tree new_type = TREE_TYPE (getdecls ()); + + if (TYPE_QUALS (cur_type)) + cur_type = cp_build_qualified_type (new_type, TYPE_QUALS (cur_type)); + else + cur_type = new_type; } gcc_assert (synth_idx == count);