Thread overview
[Issue 912] New: forward referenced error in some cases (nested class)?
Jan 31, 2007
d-bugmail
Feb 01, 2007
d-bugmail
Feb 12, 2007
d-bugmail
January 31, 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@digitalmars.com
        ReportedBy: iceelyne@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.


-- 

February 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=912





------- Comment #1 from iceelyne@gmail.com  2007-02-01 09:07 -------
//test.d:
class A {
        B.C bc;
        void test(/+B.C bc+/) {
                B.C bc = null;//OK;
        }
}
class B {
        class C {
                void test(/+A a+/) {
                }
        }
}
dmd -c test.d
errors.

//test.d:
class B {
        class C {
                void test(/+A a+/) {
                }
        }
}
class A {
        B.C bc;
        void test(/+B.C bc+/) {
                B.C bc = null;//OK;
        }
}
dmd -c test.d
OK.


-- 

February 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=912


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #2 from smjg@iname.com  2007-02-11 20:21 -------


*** This bug has been marked as a duplicate of 102 ***


--