diff options
author | Jason Merrill <jason@redhat.com> | 2019-08-05 13:38:18 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-08-05 13:38:18 -0400 |
commit | ea55c91543bd9d78aa006bc9661422ddf4c4a3f1 (patch) | |
tree | 7de5c0a08e33580e9ce04e76bb1672d4f561a061 /gcc/cp | |
parent | 55f863c4d694deafb968dbf44d08ba49bb7c0766 (diff) | |
download | gcc-ea55c91543bd9d78aa006bc9661422ddf4c4a3f1.zip gcc-ea55c91543bd9d78aa006bc9661422ddf4c4a3f1.tar.gz gcc-ea55c91543bd9d78aa006bc9661422ddf4c4a3f1.tar.bz2 |
* semantics.c (force_paren_expr): Preserve location.
From-SVN: r274120
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2715966..2b281c1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2019-08-05 Jason Merrill <jason@redhat.com> + + * semantics.c (force_paren_expr): Preserve location. + 2019-08-02 Marek Polacek <polacek@redhat.com> PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 269092d..fc90c8d 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; } |