June 28, 2004
Hi everyone,

This message is posted in following the other message I posted before regarding link error when using template. The following code has been trimmed to its possible smallest size and can still produce the problems. It seems to me that the compiler mistakenly forgets to generate some code and eventually when the linker kicks in, there is no code to link with. However, this is only my observation.

Could anyone please help me figure out what the actual problem is?

Thanks,
Sukit

=============================

public interface Iterator(ValueType) {
}

public interface Collection(ValueType) {
public Iterator!(ValueType) iterator();
}

public interface List(ValueType) : Collection!(ValueType) {
}

public class ArrayList(ValueType) : List!(ValueType) {
public Iterator!(ValueType) iterator() {
return new ArrayListIterator!(ValueType)();
}
}

public class ArrayListIterator(ValueType) : Iterator!(ValueType) {
}


void main()
{
// comment out the next line will cause link error. This must be comp bug.
// typedef Iterator!(int) IntItor;

printf("Here!\n");
ArrayList!(int) iarray = new ArrayList!(int)();

printf("Here!!\n");
iarray.iterator();

// strange! If comment out the next line, you will get "Terminated" message
// printf("Here!!!\n");
}