From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120670 invoked by alias); 16 Jan 2019 22:32:40 -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 120618 invoked by uid 89); 16 Jan 2019 22:32:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=deferring, Hx-languages-length:998, c, HContent-Transfer-Encoding:8bit X-HELO: mail-qk1-f169.google.com Received: from mail-qk1-f169.google.com (HELO mail-qk1-f169.google.com) (209.85.222.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Jan 2019 22:32:38 +0000 Received: by mail-qk1-f169.google.com with SMTP id q8so4896947qke.1 for ; Wed, 16 Jan 2019 14:32:38 -0800 (PST) Return-Path: Received: from [192.168.1.132] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id b20sm62685751qkb.17.2019.01.16.14.32.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 14:32:35 -0800 (PST) Subject: Re: [PR c++/86610] lambda captures in templates To: Nathan Sidwell , GCC Patches References: From: Jason Merrill Message-ID: <6077ac57-e237-b80d-8e47-76156dd418d3@redhat.com> Date: Wed, 16 Jan 2019 22:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00953.txt.bz2 On 1/16/19 4:48 PM, Nathan Sidwell wrote: > This PR reports a bug where we select a non-const operator function and > then apply it to a const object.  That's happening because the > expression 'c[0]' is not dependent, so we figure end up resolving it. > But the lambda capture logic doesn't capture 'c' at that point and we > have a non-const qualified 'c'.  At instantiation time we do the capture > and the by-value lambda results in const-qualified captures. > > Jason, the orginal test in process_outer_var_ref looked a little funky > -- why not just processing_template_decl? That would satisfy what the > comment says it checking.  Anyway changing the test to check DECL's > type-dependency makes the right things happen, and a bootstrap passes. > Could you review please. Hmm, I don't remember exactly my rationale for deferring captures within a template, but if this doesn't obviously break anything it seems reasonable. Go ahead. Jason