This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
array of unknown bound handling
- From: "Steven L. Zook" <SLZook at Qualstar dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Fri, 21 Jan 2005 16:53:01 -0800
- Subject: array of unknown bound handling
Using the C++ test case:
struct sTed { sTed( unsigned N ) : pInts( ( int (*)[] )new int[ N ] ) {}
int ( * pInts )[];
};
struct sSam { sSam( unsigned N ) : pInts( ( int (*)[ 0 ] )new int[ N ] )
{}
int ( * pInts )[];
};
m68k-elf-gcc 3.3.5, produces:
testpp.cpp: In constructor `sTed::sTed(unsigned int)':
testpp.cpp:1: error: cannot convert `int (*)[]' to `int (*)[0]' in
initialization
m68k-elf-gcc 3.4.3, produces:
testpp.cpp: In constructor `sSam::sSam(unsigned int)':
testpp.cpp:4: error: cannot convert `int (*)[0u]' to `int (*)[]' in
initialization
I looked through bugzilla and the 3.4.3 Changelog(s) but couldn't find
anything relating to the changes in behavior. I seems to me that 8.3.4/1
in the C++ spec implies 3.4.3 has the correct behavior in this case.
BTW, 8.3.4/1 also says "If the constant-expression (5.19) is present, it
shall be an integral constant expression and its value shall be greater
than zero.", which says to me that what I did in sSam (which was done to
fix the sTed case under 3.3.x) is invalid. Should the compiler be
accepting it (perhaps it is a GCC extension)?
Should I submit a PR against 3.3.x, 3.4.x, both, or just leave quietly?