From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37229 invoked by alias); 15 Mar 2017 20:35:37 -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 37211 invoked by uid 89); 15 Mar 2017 20:35:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy= X-HELO: mail-ot0-f181.google.com Received: from mail-ot0-f181.google.com (HELO mail-ot0-f181.google.com) (74.125.82.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 15 Mar 2017 20:35:35 +0000 Received: by mail-ot0-f181.google.com with SMTP id x37so32934611ota.2 for ; Wed, 15 Mar 2017 13:35:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1Ja/07jCZDdaTqb9piEXoPzJXTKNDpNYNFy7W5UsuHA=; b=uTVrkfEKDdM0xQjRkg73URjcyAgKG7yrQ+++JAS4OpYF+AaufvHN1lryLXohMMsmZZ HQSrXY9paDffQ/thlaIcEnZ7cHIIF3T9wa3lvLT7EHT7LgwyciYObYzrWqmPdSSXeX1K gbWU+xdsF9G8RCsyGJk2kS7p9/e4Fmp0OvdlGfYXTrzOp+Y25OZwwIK48C7Z7ictkNvp sD2/RF1VpFhAaXZZmCECUhX4COZFQhSv+ToFFGN3LaERbLxb3mJoJln4AI1Ipq7ps9Hp NEO68GDew4BoFll+5iH39r32xSzn9XDvrORIhdAJKV9+SL2Uc+UhYs77dRBAjusj43kv RtmA== X-Gm-Message-State: AFeK/H1958UI+6oAy8JHv+zJLfby9BK5/F0P/dUAOWXGBww8JZ3M6c2K0KUu6oeb94TedRPdXCJvin+b38RaqAoD X-Received: by 10.157.34.130 with SMTP id y2mr2489668ota.241.1489610135072; Wed, 15 Mar 2017 13:35:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.187.8 with HTTP; Wed, 15 Mar 2017 13:35:14 -0700 (PDT) In-Reply-To: <1489539903-13119-1-git-send-email-dmalcolm@redhat.com> References: <1489539903-13119-1-git-send-email-dmalcolm@redhat.com> From: Jason Merrill Date: Wed, 15 Mar 2017 20:35:00 -0000 Message-ID: Subject: Re: [PATCH] Fix location of typeid() (PR c++/80014) To: David Malcolm Cc: gcc-patches List Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00855.txt.bz2 On Tue, Mar 14, 2017 at 9:05 PM, David Malcolm wrote: > OK for trunk now, or should this wait until stage 1? Stage 1. > + cp_token *close_paren = cp_parser_require (parser, CPP_CLOSE_PAREN, > + RT_CLOSE_PAREN); > + location_t end_loc = close_paren ? > + close_paren->location : UNKNOWN_LOCATION; > /* If all went well, simply lookup the type-id. */ > if (cp_parser_parse_definitely (parser)) > postfix_expression = get_typeid (type, tf_warning_or_error); > @@ -6527,13 +6530,23 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, > /* Compute its typeid. */ > postfix_expression = build_typeid (expression, tf_warning_or_error); > /* Look for the `)' token. */ > - cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); > + close_paren > + = cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN); > + end_loc = close_paren ? close_paren->location : UNKNOWN_LOCATION; In both cases you're setting end_loc from close_paren, so how about only computing it once, closer to where it's used? Jason