[Issue 912] New: forward referenced error in some cases (nested class)?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 31 06:56:29 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=912

           Summary: forward referenced error in some cases (nested class)?
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: iceelyne at gmail.com


forward referenced error in some cases (nested class)?

for these 2 files:

// testa.d:
module testa;

import testb;
class A {
        B.C bc;
        void test(/+B.C bc+/) {
                B.C bc = null;//OK;
        }
}

// testb.d:
module testb;

import testa;
class B {
        class C {
                void test(/+A a+/) {
                }
        }
}

try compile with dmd 1.0

dmd -c testb.d
or
dmd -c testb.d testa.d

testb.d(4): class testb.B is forward referenced when looking for 'C'
testb.d(4): class testb.B is forward referenced when looking for 'C'
testa.d(5): Error: no property 'C' for type 'testb.B'
testa.d(5): Error: B.C is used as a type
testa.d(5): variable testa.A.bc voids have no value

but with
dmd -c testa.d testb.d

no errors (and linked correctly later also).

btw, dmd seems to be sensitive for files order, (e.g when building the DWT lib,
some cases, build ok, but linker errors when use the lib file, just by some
diff order the files was supplied (e.g build 2.08, 2.09, 2.10, 3.04, the
compilation order is diff))

Should these be considered bugs.
Not very sure, sorry.


-- 



More information about the Digitalmars-d-bugs mailing list