c++/2478: [2003-04-13] problem with pointers to arrays and VLA

Wolfgang Bangerth bangerth@ices.utexas.edu
Mon Apr 14 13:35:00 GMT 2003


> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2478
> 
> Reconfirmed on 2.95 -> 3.4 20030413. Please bump date.

I think this is actually a problem with pointers to arrays and VLAs:
-------------------------
struct {
    int (*p)[];
} B;

void foo() {
  int (*p)[];
  B.p=p;   
}
-------------------------

g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void foo()':
x.cc:7: error: cannot convert `int (*)[]' to `int (*)[0]' in assignment

It compiles in C, but not in C++. I don't know whether it should.

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/




More information about the Gcc-bugs mailing list