This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Downcasting



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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]