Downcasting

Alexandre Petit-Bianco apbianco@cygnus.com
Mon Jun 25 16:37:00 GMT 2001


Fabrice Medio writes:
> ~/tmp$ gcj -C -Wall Foobar.java
> ~/tmp$ 
>> Is this a bug or a feature ?

It's an ancient feature.
It's happening in gcc/java/decl.c:build_result_decl and I think was
introduced for better cooperation with C++ when CNI was hacked on, in
order to fix an early bug (I say `think' because I can't find the
matching ChangeLog entry, `cvs log' doesn't help either:)
 tree
 build_result_decl (fndecl)
 tree fndecl;
 {
 tree restype = TREE_TYPE (TREE_TYPE (fndecl));
 /* To be compatible with C_PROMOTING_INTEGER_TYPE_P in cc1/cc1plus. */
 if (INTEGRAL_TYPE_P (restype)
 && TYPE_PRECISION (restype) < TYPE_PRECISION (integer_type_node))
 restype = integer_type_node;
 ... 
We should find a way to be able to report this problem, regardless of
what is done for the sake of compiler cooperations. It's obviously
wrong for jc1 not to report this error (note that when the assignment
is checked, it's too late for jc1 to realize that something's wrong.)
I'm going to file a PR. Thanks!
./A


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /