Hi,
just spotted an additional error which can benefit from
cp_expr_loc_or_input_loc. Tested x86_64-linux.
Thanks, Paolo.
////////////////////
/cp
2019-08-05 Paolo Carlini <paolo.carl...@oracle.com>
* decl.c (check_array_designated_initializer): Use
cp_expr_loc_or_input_loc in one place.
/testsuite
2019-08-05 Paolo Carlini <paolo.carl...@oracle.com>
* g++.dg/cpp0x/desig1.C: Check location too.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 274124)
+++ cp/decl.c (working copy)
@@ -5520,8 +5520,9 @@ check_array_designated_initializer (constructor_el
sorry ("non-trivial designated initializers not supported");
}
else
- error ("C99 designator %qE is not an integral constant-expression",
- ce->index);
+ error_at (cp_expr_loc_or_input_loc (ce->index),
+ "C99 designator %qE is not an integral constant-expression",
+ ce->index);
return false;
}
Index: testsuite/g++.dg/cpp0x/desig1.C
===================================================================
--- testsuite/g++.dg/cpp0x/desig1.C (revision 274123)
+++ testsuite/g++.dg/cpp0x/desig1.C (working copy)
@@ -25,5 +25,5 @@ struct C
constexpr operator SE() const { return SE::se0; }
};
-int c[] = { [C()] = 0 }; // { dg-error "integral constant-expression" }
+int c[] = { [C()] = 0 }; // { dg-error "14:C99 designator .C\\\(\\\). is not
an integral constant-expression" }
// { dg-warning "does not allow C99 designated
initializers" "" { target *-*-* } .-1 }