From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17642 invoked by alias); 18 Mar 2016 15:31:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 17395 invoked by uid 89); 18 Mar 2016 15:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=trade X-HELO: mail-ob0-f170.google.com Received: from mail-ob0-f170.google.com (HELO mail-ob0-f170.google.com) (209.85.214.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Mar 2016 15:31:33 +0000 Received: by mail-ob0-f170.google.com with SMTP id ts10so119422921obc.1 for ; Fri, 18 Mar 2016 08:31:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GHn847Yo8GApI9xqxNwDZNyOtJG7eIIjVjiqQhdsz1g=; b=FbOVlDrycvLhEmCHgyuJpFayrpvWw8+YWF3htuk1Mva6KLvJOFFXcFQAhKQn0Ql8Y1 XCOU+MoYHfBPb6ASNKXDsCQKm5+c6unh4m6KhaOyfZg0adZvpWe0aB6/CLgLb1CXD/Ok ObbDpctTLtaDkHCw3qWmsTCfhDSctCVjKanNMgrZDsgKNIJrmOQZ2X+K+LKtg+FaFQhN YVheknaIuoZEiqJBEvbcwL/BbGRfafzMjd5yc/4UoY9CCmE2rzAfiS9f8HpdhDF1yJ5Q bF5PWHsIVro9/4O1Wvme8X5We/LqtajAeGSo/VBE796StNbFBUX7Fu4qyZ1VSY0Awovq QwSA== X-Gm-Message-State: AD7BkJJvENXT/cNqpLY5mnVYm/Xzjan0ZLQzE41x/vp0juxPGu4ThJ2fEhScO3elaAKGg3Wu9QcmBrHQAkYzeA== X-Received: by 10.182.196.37 with SMTP id ij5mr10152847obc.24.1458315091069; Fri, 18 Mar 2016 08:31:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.29.226 with HTTP; Fri, 18 Mar 2016 08:31:11 -0700 (PDT) In-Reply-To: <56EC1B61.80901@redhat.com> References: <1457650689-16404-1-git-send-email-patrick@parcs.ath.cx> <56EC1B61.80901@redhat.com> From: Patrick Palka Date: Fri, 18 Mar 2016 15:33:00 -0000 Message-ID: Subject: Re: [PATCH] Fix PR c++/70121 (premature folding of const var that was implicitly captured) To: Jason Merrill Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-03/txt/msg01097.txt.bz2 On Fri, Mar 18, 2016 at 11:14 AM, Jason Merrill wrote: > On 03/10/2016 05:58 PM, Patrick Palka wrote: >> >> This patch reverses the behavior of process_outer_var_ref, so that we >> always implicitly capture a const variable if it's capturable, instead >> of always trying to first fold it to a constant. This behavior however >> is wrong too, and introduces a different but perhaps less important >> regression: if we implicitly capture by value a const object that is not >> actually odr-used within the body of the lambda, we may introduce a >> redundant call to its copy/move constructor, see pr70121-2.C. > > > In general I'm disinclined to trade one bug for another, and I'm skeptical > that the different regression is less important; I imagine that most uses of > const variables will be for their constant value rather than their address. Okay, I may try to implement a complete fix for GCC 7 then.