c-typeck.c (set_init_label): Call error_at instead of error and pass LOC to it.
* c-typeck.c (set_init_label): Call error_at instead of error and pass LOC to it. * gcc.dg/init-bad-8.c: New test. From-SVN: r222613
This commit is contained in:
parent
c064f154a6
commit
9babc35248
@ -1,3 +1,8 @@
|
||||
2015-04-30 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* c-typeck.c (set_init_label): Call error_at instead of error and
|
||||
pass LOC to it.
|
||||
|
||||
2015-04-29 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
* c-parser.c (c_parser_oacc_enter_exit_data): Use
|
||||
|
@ -7926,7 +7926,7 @@ set_init_label (location_t loc, tree fieldname,
|
||||
field = lookup_field (constructor_type, fieldname);
|
||||
|
||||
if (field == 0)
|
||||
error ("unknown field %qE specified in initializer", fieldname);
|
||||
error_at (loc, "unknown field %qE specified in initializer", fieldname);
|
||||
else
|
||||
do
|
||||
{
|
||||
|
@ -1,3 +1,7 @@
|
||||
2015-04-30 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* gcc.dg/init-bad-8.c: New test.
|
||||
|
||||
2015-04-30 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/59955
|
||||
|
10
gcc/testsuite/gcc.dg/init-bad-8.c
Normal file
10
gcc/testsuite/gcc.dg/init-bad-8.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
|
||||
struct S { int i, j, k; };
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
struct S s = { .i = 1, .j = 2, .l = 4}; /* { dg-error "34:unknown field .l. specified in initializer" } */
|
||||
}
|
Loading…
Reference in New Issue
Block a user