aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-01-14 08:08:02 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-01-14 08:08:02 -0500
commit70f961a51eed84328a6c2226d4a72f90801ca3b5 (patch)
tree0ccd3b413969c837c4e57539fdf78029b0c0ba41 /gcc/cp/tree.c
parent8f66db3b32436cd7902dc553cc013dddf5b26b79 (diff)
downloadgcc-70f961a51eed84328a6c2226d4a72f90801ca3b5.zip
gcc-70f961a51eed84328a6c2226d4a72f90801ca3b5.tar.gz
gcc-70f961a51eed84328a6c2226d4a72f90801ca3b5.tar.bz2
re PR c++/46688 (g++ requires a function declaration when it should not)
PR c++/46688 * tree.c (build_vec_init_expr): Handle flexible array properly. From-SVN: r168782
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 213279a..813b88d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -474,7 +474,12 @@ build_vec_init_expr (tree type, tree init)
what functions are needed. Here we assume that init is either
NULL_TREE, void_type_node (indicating value-initialization), or
another array to copy. */
- if (init == void_type_node)
+ if (integer_zerop (array_type_nelts_total (type)))
+ {
+ /* No actual initialization to do. */;
+ init = NULL_TREE;
+ }
+ else if (init == void_type_node)
{
elt_init = build_value_init (inner_type, tf_warning_or_error);
value_init = true;