@@ -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
new file mode 100644
@@ -0,0 +1,10 @@
+// PR c++/96997
+// { dg-additional-options "-g -fdump-tree-gimple-lineno" }
+
+struct A { A(); ~A(); };
+void f(const A& = A());
+int main() { f(); }
+
+// The destructor call for the A temporary should not have the location of the
+// f declaration.
+// { dg-final { scan-tree-dump-not ".C:5" "gimple" } }