Hi! cxx_eval_vec_init_1 starts with: if (TREE_CODE (elttype) == ARRAY_TYPE) /* We only do this at the lowest level. */; else if (value_init) { init = something; } else if (!init) { init = something_else; }
For the ARRAY_TYPE elttype (i.e. multidimensional array) we are recursing. If value_init is true, we ignore init, but if init is originally NULL, we ICE trying to cp_build_array_ref of NULL. IMHO in that case we want to also ignore init and the above code will fill init in the lowest cxx_eval_vec_init_1 recursion when elttype is no longer ARRAY_TYPE. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-12-19 Jakub Jelinek <ja...@redhat.com> PR c++/51619 * semantics.c (cxx_eval_vec_init_1): If init is NULL for multidimensional array, just set eltinit to NULL_TREE. * g++.dg/cpp0x/pr51619.C: New test. --- gcc/cp/semantics.c.jj 2011-12-19 09:21:01.000000000 +0100 +++ gcc/cp/semantics.c 2011-12-19 10:45:44.498472626 +0100 @@ -7065,7 +7065,7 @@ cxx_eval_vec_init_1 (const constexpr_cal if (TREE_CODE (elttype) == ARRAY_TYPE) { /* A multidimensional array; recurse. */ - if (value_init) + if (value_init || init == NULL_TREE) eltinit = NULL_TREE; else eltinit = cp_build_array_ref (input_location, init, idx, --- gcc/testsuite/g++.dg/cpp0x/pr51619.C.jj 2011-12-19 10:49:45.128086227 +0100 +++ gcc/testsuite/g++.dg/cpp0x/pr51619.C 2011-12-19 10:49:09.000000000 +0100 @@ -0,0 +1,7 @@ +// PR c++/51619 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +struct A { virtual ~A(); }; +struct B { A a[1][1]; } b; +struct C { A a[3][3]; } c; Jakub