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]
Other format: [Raw text]

[Bug java/12434] New: Field called java causes confusion.


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Field called java causes confusion.
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: suckfish at ihug dot co dot nz
                CC: gcc-bugs at gcc dot gnu dot org

gcj implements an expression like foo.class by synthesizing a call to
java.lang.class.forName.

The compiler gets a bit confused if you have a field called java.

$ dev/test/bin/gcj -fsyntax-only broken.java
broken.java: In class `broken':
broken.java: In method `class$(java.lang.String)':
broken.java:8: error: Can't make a static reference to nonstatic variable `java'
in class `broken'.
   }
   ^
1 error


It should be possible to fix this by setting RESOLVE_PACKAGE_NAME_P on the
synthesized name, and then making sure we don't change that later.  The name
resolution code is "interesting" though.

The method name on the error message above is interesting too.

class broken {
    int java;

    Class foo()
    {
	return broken.class;
    }
}


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