[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#141900: gcj-3.0: compile breaks using temporary inner class instance



Package: gcj
Version: 2:3.0.4-5
Severity: normal

Hi.  I'm getting a gcj compile error when calling a member function of a
newly created instance of an inner class.

Try compiling the following chunk of code:

  class Test {
      public static void main(String[] args) {
          (new InnerTest()).act();
      }
  
      static public class InnerTest {
          public InnerTest() {
          }
  
          public void act() {
              System.out.println("Hi!");
          }
      }
  }

bab@espresso:/tmp> gcj -C Test.java
Test.java: In class `Test':
Test.java: In method `Test.main(java.lang.String[])':
Test.java:6: No enclosing instance for inner class `' is in scope.
           (new InnerTest()).act();
                ^
1 error

I realise that gcj claims not to understand inner classes at all (at
least in the docs it puts on my system), but it seems to do quite well in
most other situations with inner classes, and the above example compiles fine
under gcj if you replace

  (new InnerTest()).act();

with

  InnerTest t = new InnerTest();  t.act();

Thus I figure this bug is worth reporting.

Thanks - Ben.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux espresso 2.4.18-686 #2 Wed Mar 20 20:21:31 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcj depends on:
ii  cpp                          2:2.95.4-14 The GNU C preprocessor.
ii  g++-3.0                      1:3.0.4-6   The GNU C++ compiler.
ii  gcj-3.0                      1:3.0.4-6   The GNU compiler for Java(TM).



-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: