From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97400 invoked by alias); 7 Dec 2019 04:03:42 -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 97383 invoked by uid 89); 7 Dec 2019 04:03:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1792 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Dec 2019 04:03:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575691419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A213VT7yuLbQsQR3BPymR1DDIZknuX1jRDsoYhSSb8w=; b=R9BjVN5sG1SKF7pkllKelBD0MAVWyw7TxiqyyRgUXZHwpyRcxvbHaRGA3aqu+rBMbbINs6 H42c6wFE9KX3K02euOPk+pFqgg+RQcDLAw8SKgSnv+9y+xI4LZChExTscoxXqKRv9H7jEu 7XDpAmV81JimQjm5oJ0yR3+GhMX3Huw= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357-h1YkBCzVMuW7ZMr0WdYzLQ-1; Fri, 06 Dec 2019 23:03:38 -0500 Received: by mail-qk1-f197.google.com with SMTP id j1so5850444qkk.17 for ; Fri, 06 Dec 2019 20:03:38 -0800 (PST) Return-Path: Received: from [192.168.1.148] (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 u24sm6768426qkm.40.2019.12.06.20.03.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2019 20:03:35 -0800 (PST) Subject: Re: C++ PATCH for c++/91678 - wrong error with decltype and location wrapper To: Marek Polacek Cc: GCC Patches References: <20190906022455.GC14737@redhat.com> <1960c4f6-2d6f-f62c-e985-3885583110d6@redhat.com> <20190916181227.GQ14737@redhat.com> <37c8b1f9-8643-5e89-2bad-af6b76d7b8d1@redhat.com> <20191207001855.GT119925@redhat.com> From: Jason Merrill Message-ID: Date: Sat, 07 Dec 2019 04:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20191207001855.GT119925@redhat.com> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00483.txt.bz2 On 12/6/19 7:18 PM, Marek Polacek wrote: > [ Sorry for dropping the ball on this. ] > > On Tue, Sep 17, 2019 at 11:59:02PM -0400, Jason Merrill wrote: >> On 9/16/19 1:12 PM, Marek Polacek wrote: >>> On Sun, Sep 15, 2019 at 10:18:29AM -0400, Jason Merrill wrote: >>>> On 9/5/19 9:24 PM, Marek Polacek wrote: >>>>> They use >>>>> non_lvalue_loc, but that won't create a NON_LVALUE_EXPR wrapper around a location >>>>> wrapper. >>>> >>>> That seems like the bug. maybe_lvalue_p should be true for >>>> VIEW_CONVERT_EXPR. >>> >>> That makes sense but it breaks in tsubst_* which doesn't expect a >>> NON_LVALUE_EXPR wrapped around a location wrapper. >> >> Hmm, why would we get that in a template when we don't get NON_LVALUE_EXPR >> wrapped around other lvalue nodes? > > I just retested the patch without the pt.c hunk and no longer see that problem, > and the fold-const.c hunk still fixes the bogus error. Yay? > > So I think the following should be good to go: > > Bootstrapped/regtested on x86_64-linux, ok for trunk? OK. > 2019-12-06 Marek Polacek > > PR c++/91678 - wrong error with decltype and location wrapper. > * fold-const.c (maybe_lvalue_p): Handle VIEW_CONVERT_EXPR. > > * g++.dg/cpp0x/decltype73.C: New test. > > --- gcc/fold-const.c > +++ gcc/fold-const.c > @@ -2594,6 +2594,7 @@ maybe_lvalue_p (const_tree x) > case TARGET_EXPR: > case COND_EXPR: > case BIND_EXPR: > + case VIEW_CONVERT_EXPR: > break; > > default: > --- /dev/null > +++ gcc/testsuite/g++.dg/cpp0x/decltype73.C > @@ -0,0 +1,4 @@ > +// PR c++/91678 - wrong error with decltype and location wrapper. > +// { dg-do compile { target c++11 } } > + > +float* test(float* c) { return (decltype(c + 0))(float*)c; } >