When an interface is inherited from multiple sources this will result in undefined functions. This occurs when a class inherits an interface from another class and from another class and from the interface itself. See the source for the when this occurs. This will also only occur when the inheritance is separated. If all definitions reside in the same file then the undefined reference goes away. This looks like it may be thunk related. $ gdc A.d B.d /tmp/ccg0h4le.o:(.data+0x180): undefined reference to `_DT24_D1A3C_A1aMFZb' collect2: error: ld returned 1 exit status $ nm -A *.o | grep D1A3C_A1aMFZb A.o:0000000000000000 T _D1A3C_A1aMFZb A.o:000000000000006c T _DT16_D1A3C_A1aMFZb B.o: U _D1A3C_A1aMFZb B.o: U _DT24_D1A3C_A1aMFZb $ gdc main.d $ # Success $ nm -A main.o | grep A1aMFZb main.o:0000000000000000 T _D4main3C_A1aMFZb main.o:0000000000000072 T _DT16_D4main3C_A1aMFZb main.o:000000000000006c T _DT24_D4main3C_A1aMFZb === B.d === module B; import A; interface I_B : I_A { void b(); } abstract class C_B : C_A, I_B { abstract void b(); } // required to get it to try linking. void main(){} === A.d === module A; interface I_A { bool a(); } class C_A : I_A { bool a() { return false; } } === main.d === interface I_A { bool a(); } class C_A : I_A { bool a() { return false; } } interface I_B : I_A { void b(); } abstract class C_B : C_A, I_B { abstract void b(); } void main(){}
Created attachment 16 [details] A.s - Assembly output of A.d
Created attachment 17 [details] B.s - Assembly output of B.d
Created attachment 18 [details] main.s - Assembly output of main.d
This error occurs with head using GCC 4.8 on linux.
This occurs with head on GCC 4.8 on linux.
This is identical to the thunk issue we had a while ago. It broke with this change. https://github.com/D-Programming-GDC/GDC/commit/cd8bb6d03ae3134a4976689eab312e2bb57701fc#gcc/d/d-objfile.cc weakref allowed the Thunk symbol to be associated with the actual symbol. Switching to WEAK provides no such association. Additionally, the weakref solution doesn't work for MinGW resulting in rather interesting crashes. Mostly an issue with binutils and some obscure interaction I couldn't trace. The solution is the same as before and a pull request has been made. https://github.com/D-Programming-GDC/GDC/pull/42
https://github.com/D-Programming-GDC/GDC/commit/1526e44f38f888531c1032e17068dcef9fdd0df8 Does the weakref solution still produce phantom crashes in binutils for MinGW?
> Does the weakref solution still produce phantom crashes in binutils for MinGW? Looks good. Couldn't reproduce the weakref crashes and some more complicated testcases passed.
Wicked, thanks Daniel.
Re-opening bug report.
Finally fixed proper! https://github.com/D-Programming-GDC/GDC/commit/d41c3b8584262db05cf67151406209a244d0f5c4 https://github.com/D-Programming-GDC/GDC/commit/cbd6d919559697bba6bb210acc2761ae43dbaf8a