This is the mail archive of the gcc-bugs@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]

[Bug c++/15508] Size evaluation of variable-length array seem to be skipped in some cases.


------- 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


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