with a recent gcc snapshot on i386: c++ (GCC) 4.2.0 20060325 (experimental) the following tst program program: template<typename Entry> struct Array { Entry *array[32]; Array () : array ( (Entry*[1]) { 0, 0 } ) {} }; Array<void*> a; compiled with: c++ -Wall arrayinit.cc produces: arrayinit.cc: In constructor 'Array<Entry>::Array() [with Entry = void*]': arrayinit.cc:8: instantiated from here arrayinit.cc:5: internal compiler error: in process_init_constructor_array, at cp/typeck2.c:788 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Confirmed. We hit #1 0x080b0ffc in digest_init (type=<value optimized out>, init=0xb7da6ed0) at /space/rguenther/src/svn/gcc/gcc/cp/typeck2.c:788 788 gcc_assert (VEC_length (constructor_elt, v) <= len); Also happens on the 4.1 branch. 4.0.3 tells us y.c: In constructor 'Array<Entry>::Array() [with Entry = void*]': y.c:8: instantiated from here y.c:5: error: excess elements in aggregate initializer y.c:5: error: conversion from 'void** [1]' to non-scalar type 'void** [32]' requested
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
A regression hunt on powerpc-linux identified the following patch: http://gcc.gnu.org/viewcvs?view=rev&rev=102182 r102182 | giovannibajo | 2005-07-20 01:19:59 +0000 (Wed, 20 Jul 2005)
Subject: Bug 27270 Author: mmitchel Date: Tue Oct 17 02:01:27 2006 New Revision: 117814 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117814 Log: PR c++/27270 * typeck2.c (process_init_constructor_array): Reword comment. * pt.c (tsubst_copy_and_built): Call reshape_init before calling digest_init. PR c++/27270 * g++.dg/ext/complit8.C: New test. Added: trunk/gcc/testsuite/g++.dg/ext/complit8.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.2.0.
*** Bug 28248 has been marked as a duplicate of this bug. ***
Subject: Bug 27270 Author: mmitchel Date: Tue Oct 17 22:25:35 2006 New Revision: 117832 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117832 Log: PR c++/27270 * decl.c (reshape_init_class): Move check for designated to ... * parser.c (cp_parser_initializer_list): ... here. * pt.c (tsubst_copy_and_build): Use finish_compound_literal. PR c++/27270 * g++.dg/ext/complit8.C: Tweak error markers. * g++.dg/template/complit1.C: Add error marker. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/ext/complit8.C trunk/gcc/testsuite/g++.dg/template/complit1.C
Closing 4.1 branch.