From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45850 invoked by alias); 1 May 2018 11:18:07 -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 45838 invoked by uid 89); 1 May 2018 11:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yw0-f178.google.com Received: from mail-yw0-f178.google.com (HELO mail-yw0-f178.google.com) (209.85.161.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 May 2018 11:18:05 +0000 Received: by mail-yw0-f178.google.com with SMTP id l15-v6so3443746ywk.3 for ; Tue, 01 May 2018 04:18:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YzM9+xR8Tik2OTk2aEvuVwI12Cyc71dCU2DyKD372+k=; b=oB//qG7NqyYg79WqG9T7ZDL8k/a51pxNOft6gjCyuj6AsxqScyOLjtk3jGsSDp+XJ1 57593WONJoEwnxujiTLMKom1NCHs8S1eT0Xzqr40pLoMJCcSClefW1WvsvgR+25+WYGY ja2GNc/t+i+mD550fV5ERvJG3d4FSwwaz10+jaFEUO0OgOg6vp+LJVVZmV7Vxo4pYyed uhuRxqGtyosiMEeCmfBZX5DB7pWfukSK7ZaTJeFXGAuc3EvtfMeSnKmrtuFiLgie4/P1 7JxO8Ds7we/i9F0r+MYljXscc7vG3iV/y8QsKuncAP8XAyfpSCgcKIOZpo9fZgXoOfUs O01g== X-Gm-Message-State: ALQs6tBs3hH1TYd3YauoPJA5ZD5F0MzvXa/ow4a6abjcrBcaXDloaufp E4oCL9vo2UZjsr0CXZ+gMOw= X-Google-Smtp-Source: AB8JxZpSgroz4dY+pzsPRCEtTmJUrg6yhhI0xYXHc1JM4mRl7enQ0jiuc8rWt/WA6JgB9lWHBH++7Q== X-Received: by 2002:a81:9dc5:: with SMTP id u188-v6mr8375293ywg.425.1525173483455; Tue, 01 May 2018 04:18:03 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::3:7167]) by smtp.googlemail.com with ESMTPSA id g123-v6sm4101763ywf.102.2018.05.01.04.18.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 04:18:02 -0700 (PDT) Subject: Re: [PATCH] Add fix-it hint for missing return statement in assignment operators (PR c++/85523) To: David Malcolm , gcc-patches@gcc.gnu.org, Jonathan Wakely Cc: Andrew Haley References: <1525134589-44736-1-git-send-email-dmalcolm@redhat.com> From: Nathan Sidwell Message-ID: <7bd7b6e5-6f89-8729-59eb-aa86ceb10200@acm.org> Date: Tue, 01 May 2018 11:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1525134589-44736-1-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2018-05/txt/msg00010.txt.bz2 On 04/30/2018 08:29 PM, David Malcolm wrote: > Following on from the thread on the "gcc" list here: > > https://gcc.gnu.org/ml/gcc/2018-04/msg00172.html > > here's an updated version of Jonathan's patch, which: > + { > + tree valtype = TREE_TYPE (DECL_RESULT (fndecl)); > + if (TREE_CODE (valtype) == REFERENCE_TYPE > + && same_type_ignoring_top_level_qualifiers_p > + (TREE_TYPE (valtype), TREE_TYPE (current_class_ref))) While this is probably close enough, you could *) use convert_to_base to include cases where the return type's a base of the current object. *) convert_to_base would also allow dropping the REFERENCE_TYPE check here, so icky code returning by-value could also be caught. Up to you. But otherwise ok. nathan -- Nathan Sidwell