http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53196

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-02 
21:17:01 UTC ---
(In reply to comment #3)
> (In reply to comment #2)
> > That's simply because compound literals aren't valid in C++.
> 
> So this page is wrong? 
> http://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html

I didn't realise it was claimed to work in C++, but yes, I guess the docs are
wrong.  C++ provides several portable forms of initialization, there's really
no need to support another non-standard one.

These will all work for aggregate types (including "C structs")

foo f{};
foo f = {};
foo f = foo{};
foo f = foo();

I'll propose a patch to fix the docs.

Reply via email to