Commit 8e76c2bf by Mark Shinwell Committed by Mark Shinwell

re PR c++/26884 (Misleading diagnostic for invalid array initializer)

        PR c++/26884
        * typeck2.c (digest_init): Raise error upon attempts to
        initialize arrays with variables.

From-SVN: r117854
parent 94d3995a
2006-10-18 Mark Shinwell <shinwell@codesourcery.com>
PR c++/26884
* typeck2.c (digest_init): Raise error upon attempts to
initialize arrays with variables.
2006-10-17 Lee Millward <lee.millward@codesourcery.com>
PR c++/27952
......
......@@ -733,6 +733,15 @@ 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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment