decl.c (check_array_designated_initializer): Use cp_expr_loc_or_input_loc in one...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 6 Aug 2019 09:56:44 +0000 (09:56 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 6 Aug 2019 09:56:44 +0000 (09:56 +0000)
/cp
2019-08-06  Paolo Carlini  <paolo.carlini@oracle.com>

* decl.c (check_array_designated_initializer): Use
cp_expr_loc_or_input_loc in one place.

/testsuite
2019-08-06  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/cpp0x/desig1.C: Check location too.

From-SVN: r274141

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/desig1.C

index 98e3b3f..e541932 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * decl.c (check_array_designated_initializer): Use
+       cp_expr_loc_or_input_loc in one place.
+
 2019-08-06  Jakub Jelinek  <jakub@redhat.com>
 
        * parser.c (cp_parser_omp_for_loop): For OMP_LOOP, ignore parallel
index 5dda2e8..83f086d 100644 (file)
@@ -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;
     }
index b78e6b1..2a96005 100644 (file)
@@ -1,3 +1,7 @@
+2019-08-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/cpp0x/desig1.C: Check location too.
+
 2019-08-05  Marek Polacek  <polacek@redhat.com>
 
        DR 2413 - typename in conversion-function-ids.
index 393f530..dd9ad5d 100644 (file)
@@ -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 }