]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Revert EXPR_LOCATION change to build_aggr_init_expr [PR96997]
authorPatrick Palka <ppalka@redhat.com>
Wed, 17 Feb 2021 14:55:42 +0000 (09:55 -0500)
committerPatrick Palka <ppalka@redhat.com>
Wed, 17 Feb 2021 14:55:42 +0000 (09:55 -0500)
My change in r10-7718 to make build_aggr_init_expr set EXPR_LOCATION
(mimicking build_target_expr) causes the debuginfo regression PR96997.
Given that this change is mostly independent of the rest of the commit,
and that the only fallout of reverting it is a less accurate error
message location in a testcase introduced in the same commit, it seems
the best way forward is to just revert this part of the commit.

gcc/cp/ChangeLog:

PR debug/96997
PR c++/94034
* tree.c (build_aggr_init_expr): Revert r10-7718 change.

gcc/testsuite/ChangeLog:

PR debug/96997
PR c++/94034
* g++.dg/cpp1y/constexpr-nsdmi7b.C:  Adjust expected location of
"call to non-'constexpr' function" error message.

(cherry picked from commit 78a6d0e30d7950216dc0c5be5d65d0cbed13924c)

gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C

index 59cef1770adadd64b0d7fca07dcec6c8e2b46dbf..717af8c1f19dcaadcc5bc6b68d41fa31fb7791ca 100644 (file)
@@ -669,9 +669,6 @@ build_aggr_init_expr (tree type, tree init)
   else
     rval = init;
 
-  if (location_t loc = EXPR_LOCATION (init))
-    SET_EXPR_LOCATION (rval, loc);
-
   return rval;
 }
 
index 86d8ab4e759c789d35c7b2b9b0090f8022c430ab..ec10ddd2be8ff4ba684627036c78bfa6b3654f84 100644 (file)
@@ -20,8 +20,8 @@ bar()
 {
   A a = foo();
   a.p->n = 5;
-  return a; // { dg-error "non-.constexpr." }
-}
+  return a;
+} // { dg-error "non-.constexpr." }
 
 constexpr int
 baz()