On Wed, 13 Dec 2023, Jason Merrill wrote: > Tested x86_64-pc-linux-gnu, applying to trunk. > > -- 8< -- > > When building an AGGR_INIT_EXPR from a CALL_EXPR, we shouldn't lose location > information. > > gcc/cp/ChangeLog: > > * tree.cc (build_aggr_init_expr): Copy EXPR_LOCATION.
I made a similar change in the past which caused the debug regression PR96997 which I fixed by reverting the change in r11-7263-g78a6d0e30d7950 (didn't do much deeper analysis than that). Unfortunately it seems this regression is back now. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp1y/constexpr-nsdmi7b.C: Adjust line. > * g++.dg/template/copy1.C: Likewise. > --- > gcc/cp/tree.cc | 1 + > gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C | 4 ++-- > gcc/testsuite/g++.dg/template/copy1.C | 2 +- > 3 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc > index da4d5c51f07..c4e41fd7b5c 100644 > --- a/gcc/cp/tree.cc > +++ b/gcc/cp/tree.cc > @@ -689,6 +689,7 @@ build_aggr_init_expr (tree type, tree init) > CALL_EXPR_OPERATOR_SYNTAX (rval) = CALL_EXPR_OPERATOR_SYNTAX (init); > CALL_EXPR_ORDERED_ARGS (rval) = CALL_EXPR_ORDERED_ARGS (init); > CALL_EXPR_REVERSE_ARGS (rval) = CALL_EXPR_REVERSE_ARGS (init); > + SET_EXPR_LOCATION (rval, EXPR_LOCATION (init)); > } > else > rval = init; > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C > b/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C > index a410e482664..586ee54124c 100644 > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C > @@ -20,8 +20,8 @@ bar() > { > A a = foo(); > a.p->n = 5; > - return a; > -} // { dg-error "non-.constexpr." "" { target c++20_down } } > + return a; // { dg-error "non-.constexpr." "" { target c++20_down } } > +} > > constexpr int > baz() > diff --git a/gcc/testsuite/g++.dg/template/copy1.C > b/gcc/testsuite/g++.dg/template/copy1.C > index eacd9e2c025..7e0a3805a77 100644 > --- a/gcc/testsuite/g++.dg/template/copy1.C > +++ b/gcc/testsuite/g++.dg/template/copy1.C > @@ -6,10 +6,10 @@ > > struct A > { > - // { dg-error "reference" "" { target c++14_down } .+1 } > A(A&); // { dg-message "A::A" "" { target c++14_down } > } > template <class T> A(T); // { dg-message "A::A" "" { target c++14_down } > } > }; > > +// { dg-error "reference" "" { target c++14_down } .+1 } > A a = 0; // { dg-error "no match" "" { target c++14_down } } > > > base-commit: d2b269ce30d77dbfc6c28c75887c330d4698b132 > -- > 2.39.3 > >