From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78330 invoked by alias); 3 Dec 2018 21:58:25 -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 78320 invoked by uid 89); 3 Dec 2018 21:58:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-ot1-f67.google.com Received: from mail-ot1-f67.google.com (HELO mail-ot1-f67.google.com) (209.85.210.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Dec 2018 21:58:23 +0000 Received: by mail-ot1-f67.google.com with SMTP id f18so13160852otl.11 for ; Mon, 03 Dec 2018 13:58:23 -0800 (PST) MIME-Version: 1.0 References: <20181129215227.GV12380@tucnak> <5c68bcdb-0cbc-6044-f6c4-fe241a307cf5@redhat.com> <20181202130722.GP12380@tucnak> <74c055da-473a-9a34-15fc-badc3c13e504@redhat.com> <20181203213648.GC12380@tucnak> In-Reply-To: <20181203213648.GC12380@tucnak> From: Jason Merrill Date: Mon, 03 Dec 2018 21:58:00 -0000 Message-ID: Subject: Re: [C++ PATCH] Fix xvalue COND_EXPR handling (PR c++/88103) To: Jakub Jelinek Cc: Nathan Sidwell , gcc-patches List Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00132.txt.bz2 On Mon, Dec 3, 2018 at 4:36 PM Jakub Jelinek wrote: > > On Mon, Dec 03, 2018 at 02:44:32PM -0500, Jason Merrill wrote: > > > > Is there a reason not to use the 'move' function here? > > > > > > That doesn't work at all. move doesn't call cp_convert, but > > > build_static_cast (though for the same reference && type). > > > But while cp_convert only adds NOP_EXPR around it, build_static_cast adds > > > a target_expr, addr_expr around that, nop_expr cast to the reference && type > > > and finally indirect_ref that the caller doesn't expect, because it adds it > > > by itself, e.g. in > > > 2424 if (temp) > > > 2425 object = cp_build_fold_indirect_ref (temp); > > > > So the caller is trying to take the address of the COND_EXPR, which should > > have POINTER_TYPE. And then indirecting that gives an lvalue, as it should. > > The bug is in the caller, build_class_member_access_expr. > > So like this then (if it passes bootstrap/regtest)? Seems to fix the > testcase. > > 2018-12-03 Jakub Jelinek > > PR c++/88103 > * typeck.c (build_class_member_access_expr): If unary_complex_lvalue > turned xvalue_p into non-xvalue_p, call move on it. > > * g++.dg/cpp0x/rv-cond3.C: New test. OK, thanks. Jason