This is needed for the locations of string literals to be usable,
otherwise the ADDR_EXPR has UNKNOWN_LOCATION, despite wrapping
a node with a correct location_t.
gcc/cp/ChangeLog:
* typeck.c (build_address): Use location of operand when building
address expression.
---
gcc/cp/typeck.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9130c10..dd3e19d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5621,7 +5621,7 @@ build_address (tree t)
if (error_operand_p (t) || !cxx_mark_addressable (t))
return error_mark_node;
gcc_checking_assert (TREE_CODE (t) != CONSTRUCTOR);
- t = build_fold_addr_expr (t);
+ t = build_fold_addr_expr_loc (EXPR_LOCATION (t), t);
if (TREE_CODE (t) != ADDR_EXPR)
t = rvalue (t);
return t;
--
1.8.5.3