re PR c/52880 (-Woverride-init emitts unexpected error)

PR c/52880
	* c-typeck.c (set_nonincremental_init,
	set_nonincremental_init_from_string): Pass true instead of false
	as IMPLICIT to add_pending_init.

	* gcc.dg/pr52880.c: New test.

From-SVN: r186809
This commit is contained in:
Jakub Jelinek 2012-04-25 11:18:49 +02:00 committed by Jakub Jelinek
parent 3fef1872df
commit 9a7ac8f881
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2012-04-25 Jakub Jelinek <jakub@redhat.com>
PR c/52880
* c-typeck.c (set_nonincremental_init,
set_nonincremental_init_from_string): Pass true instead of false
as IMPLICIT to add_pending_init.
2012-04-24 Georg-Johann Lay <avr@gjlay.de>
Backport from 2012-04-24 mainline r186768.

View File

@ -7598,7 +7598,7 @@ set_nonincremental_init (struct obstack * braced_init_obstack)
FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value)
{
add_pending_init (index, value, NULL_TREE, false,
add_pending_init (index, value, NULL_TREE, true,
braced_init_obstack);
}
constructor_elements = 0;
@ -7691,7 +7691,7 @@ set_nonincremental_init_from_string (tree str,
}
value = build_int_cst_wide (type, val[1], val[0]);
add_pending_init (purpose, value, NULL_TREE, false,
add_pending_init (purpose, value, NULL_TREE, true,
braced_init_obstack);
}

View File

@ -1,3 +1,8 @@
2012-04-25 Jakub Jelinek <jakub@redhat.com>
PR c/52880
* gcc.dg/pr52880.c: New test.
2012-04-24 Georg-Johann Lay <avr@gjlay.de>
PR testsuite/52641

View File

@ -0,0 +1,10 @@
/* PR c/52880 */
/* { dg-do compile } */
/* { dg-options "-Woverride-init" } */
struct A { int a; int b; };
struct B { struct A c; int d, e; };
struct B f = { .c.a = 0, .e = 1, .d = 2, .c.b = 3 };
struct C { int g; int h; };
struct D { int i; struct C j; int k; };
struct D l = { .j.g = 0, .k = 1, .i = 2, .j.h = 3 };