From 063564ecbfc618cd019f86216a0224e144effae1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 13 Dec 2023 14:15:44 -0500 Subject: c++: TARGET_EXPR location in default arg [PR96997] My r14-6505-g52b4b7d7f5c7c0 change to copy the location in build_aggr_init_expr reopened PR96997; let's fix it properly this time, by clearing the location like we do for other trees. PR c++/96997 gcc/cp/ChangeLog: * tree.cc (bot_manip): Check data.clear_location for TARGET_EXPR. gcc/testsuite/ChangeLog: * g++.dg/debug/cleanup2.C: New test. --- gcc/cp/tree.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/cp/tree.cc') diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index c4e41fd..d26e73a 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -3170,6 +3170,9 @@ bot_manip (tree* tp, int* walk_subtrees, void* data_) if (TREE_OPERAND (u, 1) == error_mark_node) return error_mark_node; + if (data.clear_location) + SET_EXPR_LOCATION (u, input_location); + /* Replace the old expression with the new version. */ *tp = u; /* We don't have to go below this point; the recursive call to -- cgit v1.1