From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126968 invoked by alias); 6 Dec 2018 15:11:35 -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 126955 invoked by uid 89); 6 Dec 2018 15:11:34 -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=friend X-HELO: mail-qk1-f181.google.com Received: from mail-qk1-f181.google.com (HELO mail-qk1-f181.google.com) (209.85.222.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Dec 2018 15:11:33 +0000 Received: by mail-qk1-f181.google.com with SMTP id d19so483509qkg.5 for ; Thu, 06 Dec 2018 07:11:33 -0800 (PST) Return-Path: Received: from [192.168.1.149] (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 f14sm395145qka.18.2018.12.06.07.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 07:11:30 -0800 (PST) Subject: Re: [C++ Patch] Three additional bitfield diagnostic tweaks (a regression fix included) To: Paolo Carlini , "gcc-patches@gcc.gnu.org" References: From: Jason Merrill Message-ID: <767ff78b-747c-d48c-f061-766faab2f8e9@redhat.com> Date: Thu, 06 Dec 2018 15:11: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: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00371.txt.bz2 On 12/6/18 5:49 AM, Paolo Carlini wrote: > Hi, > > I'm bundling together 3 more. In attachment order: > > 1- Since we decided to explicitly print the wrong type, I suppose we > want to consistently do that in templates too. OK. > 2- Unfortunately I have to fix another buglet I recently introduced, > completely similar to c++/88222 fixed by Marek. Well, at least we will > not print anymore an empty '' when the unqualified_id is null because > the field is unnamed. > - error_at (declarator->id_loc, > - "%qE is neither function nor member function; " > - "cannot be declared friend", unqualified_id); > + if (unqualified_id && declarator) > + error_at (declarator->id_loc, > + "%qE is neither function nor member function; " > + "cannot be declared friend", unqualified_id); > + else > + error ("unnamed field is neither function nor member " > + "function; cannot be declared friend"); I wonder if we want to use the 'name' variable here. > 3- In the non-static case too, when from grokdeclarator we are calling > FIELD_DECL and passing the location as first argument, I think we want > to likewise pass declarator->id_loc when available. > - decl = build_decl (input_location, > + decl = build_decl (declarator > + ? declarator->id_loc > + : input_location, I think we want to put this in a local variable, to share with the static case and probably other places in grokdeclarator. Jason