so, now I've run a couple of tests regarding your problem.
All compilations have been performed with your example code above, using the following scheme:
$(GCC) -o a.out test.c -Wall -Wextra -pedantic -std=$(STD)
This yielded the following results:
for GCC = gcc
, the standards -std=c89; -std=iso9899:1990; -std=iso9899:199409; -std=gnu89
resulted in a warning showing up: initializer element is not computable at load time
and undefined behaviour at runtime, meaning that the second and third value of the array were random garbage.
the standards -std=c99; std=iso9899:1999; -std=gnu99
did not produce this warning, but also showed undefined behaviour at runtime.
for GCC = g++
, the standards -std=c++98; -std=gnu++98; -std=c++0x
produced no warning, and the code worked as you'd expected it to, resulting in an array containing the values {5, 6, 6}
.
However, as most of the people advised, it might be unwise to use this, since your code might behave differently on other compilers, or maybe even other versions of the same compiler, which is generally a bad thing :)
hope that helped.