This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: error: ISO C++ forbids initialization in array new


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]