ldc-developers/ldc — Issue #62: Forward Reference Issues
Author: dsimcha
Created: 2012-01-13 14:15:15+00:00
State: open

// a.d
import b;

// b.d
import hash;

void fun() {
alias StackSet!(string) SS;
}

// hash.d
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);
}
}

Build command/result:

$ ldc2 -O3 -c a.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
instantiatied in b.d(4): StackSet!(string)
b.d(4): Error: template instance hash.StackSet!(string) error instantiating