This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: error: ISO C++ forbids initialization in array new
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: <monge at sns dot it>,<gcc at gcc dot gnu dot org>
- Date: Sat, 15 May 2004 02:02:31 +0200
- Subject: Re: error: ISO C++ forbids initialization in array new
- References: <200405150148.39204.monge@sns.it>
Maurizio Monge wrote:
> the following code:
>
> int* b = new int[7](3);
>
> Compiles on gcc-3.3.1 (unless -pedantic), but it alwais fails on
> gcc-3.4.
The code is ill-formed, the initializer cannot be specified in an array new
expression, so GCC 3.4.0 is right in rejecting it. Also, -pedantic-errors is
the default for the C++ frontend now. You can try with -fpermissive, but I
doubt it would change things.
> I found nothing about it on manuals, has it been
> intentionally removed or is this a bug in gcc-3.4?
It was probably fixed with the merge of the new parser. You can check
http://gcc.gnu.org/gcc-3.4/changes.html for other C++-related changes.
Giovanni Bajo