The following test case, derived from Eclipse/ecj, fails to compile on HEAD and
current 4.0 branch. This is a regression since 4.0.0.

package ast;

import classfmt.*;
public abstract class ASTNode implements ClassFileConstants {
}

---

package ast;

public class EqualExpression extends ASTNode {
        public void resolveType() {
                long foo = JDK1_5;
        }
}

---

package classfmt;

public interface ClassFileConstants {
        int MINOR_VERSION_0 = 0;
        long JDK1_5 = (long) ClassFileConstants.MINOR_VERSION_0;
}


$ gcj -c ast/EqualExpression.java
./classfmt/ClassFileConstants.java: In class 'ast.EqualExpression':
./classfmt/ClassFileConstants.java: In method 
'ast.EqualExpression.resolveType()':
./classfmt/ClassFileConstants.java:5: error: Undefined variable or class name:
‘ClassFileConstants.MINOR_VERSION_0’.
        long JDK1_5 = (long) ClassFileConstants.MINOR_VERSION_0;
                                ^
1 error

-- 
           Summary: Problem folding static fields across packages
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mckinlay at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23891

Reply via email to