https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96997

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
It looks like the problematic hunk from r10-7718 is

* tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR to that
of its initializer.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index
1d311b0fe61dc149772610e356fd81559ecdb438..8e4934c00093ec5f5627b52049394cbbca17d81f
100644 (file)
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -669,6 +669,9 @@ 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;
 }

At the time I figured this change ought to be harmless since build_target_expr
does the same thing, and unfortunately didn't consider that it might impact
debug information generation.

Shall we just revert this hunk?  IIRC, its only purpose in this patch was to
improve the location of the "call to non-'constexpr'" diagnostic from
potential_constant_expression_1 for constexpr-nsdmi7b.C.  The only fallout of
reverting this hunk would be:

diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C
b/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi7b.C                                
index 86d8ab4e759..ec10ddd2be8 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." }                                  
-}                                                                              
+  return a;                                                                    
+} // { dg-error "non-.constexpr." }                                            

 constexpr int                                                                  
 baz()

Reply via email to