From f107ee3310e54209571c0466e019fb0e5989bf30 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 4 Aug 2015 11:18:40 -0400 Subject: [PATCH] * tree.c (build_target_expr): Copy the location from value. From-SVN: r226580 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/tree.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ca3be9f127d..e53e00d088b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2015-08-04 Jason Merrill + + * tree.c (build_target_expr): Copy the location from value. + 2015-08-02 Patrick Palka * parser.c (cp_parser_selection_statement): Move handling of diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 149c37da908..46818b43e81 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -338,6 +338,8 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain) if (t == error_mark_node) return error_mark_node; t = build4 (TARGET_EXPR, type, decl, value, t, NULL_TREE); + if (EXPR_HAS_LOCATION (value)) + SET_EXPR_LOCATION (t, EXPR_LOCATION (value)); /* We always set TREE_SIDE_EFFECTS so that expand_expr does not ignore the TARGET_EXPR. If there really turn out to be no side-effects, then the optimizer should be able to get rid of -- 2.30.2