g++ current fails to recognize a zero size array like "T array[0]" as a complete type
Pekka Nikander
pekka.nikander@hut.fi
Sun Mar 19 23:38:00 GMT 2000
GCC version: current
System type: FreeBSD 3.2 cross-compiling for h8300
In complete_type_or_else(cp/typeck.c, version 1.267) on line 223,
the test
TYPE_SIZE (type) == size_zero_node
was changed to
integer_zerop (TYPE_SIZE (type))
After this change, in a template like
template<class T> class JArray : public __JArray {
T data[0];
public:
friend T* elements<>(JArray<T>& x);
friend T* elements<>(JArray<T>* x);
};
the member T data[0] is not recognized as a complete
type any more, causing an internal compiler error when
trying to compile source that worked before:
/usr/local/rcx/bin/h8300-hitachi-rcx-g++ -O -pipe -Dh8300 -I../../include
-I../.. -I../../librcx -Os -fomit-frame-pointer -finline-functions
-finline-limit-10 -c natRuntime.cpp
../../include/gcj/array.h: In instantiation of `JArray<java::lang::Object *>':
natRuntime.cpp:26: instantiated from here
../../include/gcj/array.h:28: Internal compiler error 108.
../../include/gcj/array.h:28: Please submit a full bug report.
../../include/gcj/array.h:28: See
../../include/gcj/array.h:28: <URL: http://www.gnu.org/software/gcc/bugs.html >
../../include/gcj/array.h:28: for instructions.
*** Error code 1
When the
T data[0]
is changed to
T data[1]
the code compiles.
--Pekka Nikander
More information about the Gcc-bugs
mailing list