We triggered an assert on attached testcase, because when building the
compound literal with empty initial value complete_array_type returns
3, but we assert it returns 0. It returns 3 only in the pedantic mode,
where empty initializer braces are forbidden. Since we already gave
a warning, I think we could loosen the assert a bit and allow
empty initial values at that point. sizeof on such compound literal
then yields zero, which I think is correct.
The assert exists even in GCC 4.0.
Regtested/botstrapped on x86_64-linux, ok for trunk and 4.8 and
perhaps even 4.7?
2013-12-02 Marek Polacek <polacek@redhat.com>
PR c/59351
c/
* c-decl.c (build_compound_literal): Allow compound literals with
empty initial value.
testsuite/
* gcc.dg/pr59351.c: New test.