D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7098 - Annoying Forward Reference Error When Compiling Multiple Files
Summary: Annoying Forward Reference Error When Compiling Multiple Files
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P3 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-12-11 18:20 UTC by David Simcha
Modified: 2023-01-16 00:56 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011-12-11 18:20:41 UTC
// hash.d.  This is part of a library, not the application.  Therefore, it
// is in the import path but is not explicitly passed to DMD
struct HashRange(K, S, ) {
    size_t _length;

    this(S* set) {
        this._length = set.length;
    }

}


struct StackSet(K) {
    
    HashRange!(K, typeof(this)) elems() {
        assert(0);
    }

    
    @property size_t length() {
        assert(0);
    }
}

// a.d.  This is part of the application.
import hash;

// b.d.  This is also part of the application.
import hash;

void fun() {
    StackSet!string alreadyDone;
}

$ dmd -c a.d b.d
hash.d(11): Error: struct hash.StackSet!(string).StackSet no size yet for forward reference
hash.d(5): Error: cannot implicitly convert expression ((*set).length()) of type size_t to ulong
hash.d(13): Error: template instance hash.HashRange!(string,StackSet!(string)) error instantiating
b.d(4):        instantiated from here: StackSet!(string)
b.d(4): Error: template instance hash.StackSet!(string) error instantiating
Comment 1 Maksim Zholudev 2016-03-28 13:42:04 UTC
Seems to be fixed before 2.066.1-rc2 (tested on 64-bit Linux).
I was unable to build older releases with Digger: 2.054 fails to build and 2.060 can't find object.d.
Comment 2 Iain Buclaw 2023-01-16 00:56:48 UTC
No longer reproducible