From 1a013865bed6ae419945945e418d078bf30f8b89 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 6 Aug 2019 09:56:44 +0000 Subject: [PATCH] decl.c (check_array_designated_initializer): Use cp_expr_loc_or_input_loc in one place. /cp 2019-08-06 Paolo Carlini * decl.c (check_array_designated_initializer): Use cp_expr_loc_or_input_loc in one place. /testsuite 2019-08-06 Paolo Carlini * g++.dg/cpp0x/desig1.C: Check location too. From-SVN: r274141 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 5 +++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/desig1.C | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98e3b3f41d8..e5419322d6f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-08-06 Paolo Carlini + + * decl.c (check_array_designated_initializer): Use + cp_expr_loc_or_input_loc in one place. + 2019-08-06 Jakub Jelinek * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 5dda2e8e33d..83f086d75ae 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5520,8 +5520,9 @@ check_array_designated_initializer (constructor_elt *ce, 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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b78e6b1d56e..2a960051feb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-08-06 Paolo Carlini + + * g++.dg/cpp0x/desig1.C: Check location too. + 2019-08-05 Marek Polacek DR 2413 - typename in conversion-function-ids. diff --git a/gcc/testsuite/g++.dg/cpp0x/desig1.C b/gcc/testsuite/g++.dg/cpp0x/desig1.C index 393f5309f7f..dd9ad5db5a3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/desig1.C +++ b/gcc/testsuite/g++.dg/cpp0x/desig1.C @@ -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 } -- 2.30.2