www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - linux linking error with interfaces

I've been poking around with porting the Classpath implementation of Java's
Collection Framework and have bumped up against the following linux bug:

interface Iterator(T) {}
interface Iterable(T) {
  Iterator!(T) foo();
class List(T) : Iterable!(T) {
  Iterator!(T) foo() {return new ListIterator!(T);}
class ListIterator(T) : Iterator!(T) {}
int main() { 
  List!(int) x = new List!(int);
  return 0; 

compile with dmd-0.95 on linux gives

gcc foo.o -o foo -lphobos -lpthread -lm
undefined reference to `_Interface_3foo10Iterator_i8Iterator'
collect2: ld returned 1 exit status
--- errorlevel 1

I haven't tried on Windows. I haven't found any workarounds.

Jul 17 2004