This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Downcasting
- To: java at gcc dot gnu dot org
- Subject: Downcasting
- From: Fabrice Medio <fmedio at mandrakesoft dot com>
- Date: 25 Jun 2001 23:59:48 +0200
Hello !
One of my colleagues noticed that gcc didn't check for implicit
downcastings.
Look at this :
~/tmp$ cat Foobar.java
class Foobar { char func(int i) { return i; } }
Sun compilers obviously refuse to compile :
/tmp$ javac Foobar.java
Foobar.java:2: possible loss of precision
found : int
required: char
class Foobar { char func(int i) { return i; } }
^
1 error
On the contrary, gcj remains silent :
~/tmp$ gcj -C -Wall Foobar.java
~/tmp$
Is this a bug or a feature ?
Fabrice
--
Fabrice Medio <fmedio@mandrakesoft.com>