From ea55c91543bd9d78aa006bc9661422ddf4c4a3f1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Aug 2019 13:38:18 -0400 Subject: [PATCH] * semantics.c (force_paren_expr): Preserve location. From-SVN: r274120 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/semantics.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2715966e6f4..2b281c1672c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2019-08-05 Jason Merrill + + * semantics.c (force_paren_expr): Preserve location. + 2019-08-02 Marek Polacek PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 269092de1ef..fc90c8d6f0e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1745,14 +1745,16 @@ force_paren_expr (tree expr) && TREE_CODE (expr) != SCOPE_REF) return expr; + location_t loc = cp_expr_location (expr); + if (TREE_CODE (expr) == COMPONENT_REF || TREE_CODE (expr) == SCOPE_REF) REF_PARENTHESIZED_P (expr) = true; else if (processing_template_decl) - expr = build1 (PAREN_EXPR, TREE_TYPE (expr), expr); + expr = build1_loc (loc, PAREN_EXPR, TREE_TYPE (expr), expr); else { - expr = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (expr), expr); + expr = build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (expr), expr); REF_PARENTHESIZED_P (expr) = true; } -- 2.30.2