Hi,
I'm pretty sure that we should accept this. Tested x86_64-linux.
Thanks,
Paolo.
////////////////////
/cp
2014-12-01 Paolo Carlini <[email protected]>
PR c++/60859
* decl.c (reshape_init_r): Do not reject value-initialization of
scalar array element.
/testsuite
2014-12-01 Paolo Carlini <[email protected]>
PR c++/60859
* g++.dg/cpp0x/initlist88.C: New.
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 218217)
+++ cp/decl.c (working copy)
@@ -5511,9 +5511,15 @@ reshape_init_r (tree type, reshape_iter *d, bool f
{
if (SCALAR_TYPE_P (type))
{
- if (complain & tf_error)
- error ("braces around scalar initializer for type %qT", type);
- init = error_mark_node;
+ if (cxx_dialect < cxx11
+ /* Isn't value-initialization. */
+ || CONSTRUCTOR_NELTS (init) > 0)
+ {
+ if (complain & tf_error)
+ error ("braces around scalar initializer for type %qT",
+ type);
+ init = error_mark_node;
+ }
}
else
maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
Index: testsuite/g++.dg/cpp0x/initlist88.C
===================================================================
--- testsuite/g++.dg/cpp0x/initlist88.C (revision 0)
+++ testsuite/g++.dg/cpp0x/initlist88.C (working copy)
@@ -0,0 +1,4 @@
+// PR c++/60859
+// { dg-do compile { target c++11 } }
+
+int a[] = { {} };