This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

gcc-java does not understand constant in switch


gcc --version
2.96
(RedHat 7.0 Public Beta)

cat Y.java
public class Y {
public static void main(String [] args)
{
 final int x=1;
 int i=2;
 switch(i) {
   case x:
 System.err.println(x);
   default:
        System.err.println("default");
 }
}
}

gcj Y.java  -o x --main=Y
Y.java: In class `Y':
Y.java: In method `main(java.lang.String[])':
Y.java:7: Constant expression required.
   case x:
   ^
1 error



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