c++: fix debug info for array temporary [PR107154]
commitce3a1b5976079b1467473b4628f05797fd2eae08
authorJason Merrill <jason@redhat.com>
Tue, 4 Oct 2022 21:06:04 +0000 (4 17:06 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 4 Oct 2022 22:53:52 +0000 (4 18:53 -0400)
tree910e324c10dea40e5593b26c07473e29733e85c0
parent0764dc8537a4f87089ecd32391cb5f8803b43c96
c++: fix debug info for array temporary [PR107154]

In the testcase the elaboration of the array init that happens at genericize
time was getting the location info for the end of the function; fixed by
doing the expansion at the location of the original expression.

PR c++/107154

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_genericize_init_expr): Use iloc_sentinel.
(cp_genericize_target_expr): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/debug/dwarf2/lineno-array1.C: New test.
gcc/cp/cp-gimplify.cc
gcc/testsuite/g++.dg/debug/dwarf2/lineno-array1.C [new file with mode: 0644]