https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489

--- Comment #3 from Deniz Bahadir <D.Bahadir at GMX dot de> ---
Thanks for the comment.

So, at least we aggree that the cases for addr2 and addr6 should not warn (in
C++11) as it initializes all values. Possibly this holds true for addr9, too?

I always thought that the cases for addr3 and addr7 (and maybe also addr4 and
addr8) should initialize the entire struct with zeros. (This is for example
mentioned in that explanation:
http://www.codeguru.com/cpp/cpp/article.php/c19081/C-2011-Uniform-Initialization.htm)
By a quick look through the C++11 standard I was not able to find the section
which states that.
However, I found something similar in section "8.5.1 Aggregates", paragraph 7:

"If there are fewer initializer-clauses in the list than there are members in
the aggregate, then each member not explicitly initialized shall be initialized
from an empty initializer list (8.5.4). [ Example:
struct S { int a; const char* b; int c; };
S ss = { 1, "asdf" };
initializes ss.a with 1, ss.b with "asdf", and ss.c with the value of an
expression of the form int(), that is, 0. —end example ]"

So, I am unsure if the compiler should warn about that or not.

Could maybe someone clarify if the statement from the link above about the
cases addr3 and addr7 is correct?

Reply via email to