This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR c++/26884


Mark Shinwell wrote:

Index: gcc/cp/typeck2.c
===================================================================
--- gcc/cp/typeck2.c    (revision 117455)
+++ gcc/cp/typeck2.c    (working copy)
@@ -733,6 +733,13 @@ digest_init (tree type, tree init)

return error_mark_node;
}
+
+ if (TREE_CODE (type) == ARRAY_TYPE && TREE_CODE (init) != CONSTRUCTOR)
+ {
+ error ("array must be initialized with a brace-enclosed initializer");
+ return error_mark_node;
+ }
+
return convert_for_initialization (NULL_TREE, type, init,
LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING,
"initialization", NULL_TREE, 0);




This version looks fine -- but watch your line-wrapping; it looks like you're close to exceeding the 72-column width. If you are, make sure you wrap appropriately before check-in, e.g.:

  if (TREE_CODE ...
      && TREE_CODE (init) ...)

  error ("array ... "
         "brace-enclosed initializer");

Thanks!

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]