Commit c3e38a03 by Marek Polacek

re PR c/64856 (Initializing struct not accepted in gnu99)

	PR c/64856
	* c-typeck.c (process_init_element): Don't always wrap
	COMPOUND_LITERAL_EXPR in a SAVE_EXPR in C99 mode when
	initializing a range of elements.

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

From-SVN: r220550
parent 62484417
2015-02-09 Marek Polacek <polacek@redhat.com>
PR c/64856
* c-typeck.c (process_init_element): Don't always wrap
COMPOUND_LITERAL_EXPR in a SAVE_EXPR in C99 mode when
initializing a range of elements.
2015-02-04 Jakub Jelinek <jakub@redhat.com>
PR c/64824
......
......@@ -8785,8 +8785,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
/* If value is a compound literal and we'll be just using its
content, don't put it into a SAVE_EXPR. */
if (TREE_CODE (value.value) != COMPOUND_LITERAL_EXPR
|| !require_constant_value
|| flag_isoc99)
|| !require_constant_value)
{
tree semantic_type = NULL_TREE;
if (TREE_CODE (value.value) == EXCESS_PRECISION_EXPR)
......
2015-02-09 Marek Polacek <polacek@redhat.com>
PR c/64856
* gcc.dg/pr64856.c: New test.
2015-02-09 Jakub Jelinek <jakub@redhat.com>
PR target/64979
......
/* PR c/64856 */
/* { dg-do compile } */
/* { dg-options "" } */
struct A {
unsigned long b;
};
struct B {
struct A c[5];
};
struct B d = { .c = { [0 ... 4] = (struct A){ .b = 2 } } };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment