This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.
- From: "takashi dot yano at nifty dot ne dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 14:17:52 -0000
- Subject: [Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.
- References: <20040518102702.15508.takashi.yano@nifty.ne.jp>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From takashi dot yano at nifty dot ne dot jp 2004-05-18 14:17 -------
(In reply to comment #3)
> As, the type return by new int [2][r] is not int *[r] but is int **.
I beleve it is not 'int *[r]', but is 'int (*)[r]'.
'int *[r]' is a array of pointer to integer,
while 'int (*)[r]' is a pointer to array of integer.
In GCC 3.3.1, following error occurs compiling the code:
void func(int r)
{
int **a = new int [2][r];
delete [] a;
}
a.cc: In function `void func(int)':
a.cc:3: error: cannot convert `int (*)[((r - 1) + 1)]' to `int**' in
initialization
Does the return type of 'new int [2][r]' in GCC 3.4.0 differ from that in GCC
3.3.1?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15508