Thread overview
GDC bug? duplicates symbols when using mixin and interface
October 24
I have been trying to compile gtkd with gdc but without success. I always end up with some duplicates symbols when gdc try to link final binary [https://github.com/gtkd-developers/GtkD/issues/282]

I have tried it with ldc and dmd too, and both are working fine.
So I guess there is some symbolgen issue with gdc. To make it (hopefuly) easier to
investigate I have try to reduce it as much as I can by hand (I am unable to use dusmite or how it is called).

So to reproduce this issue one need to have two files for eg. (b.d and c.d) see below

// b.d ==========================================
class B : I
{
	protected override void getStruct(){}
	mixin A!();
	
}

mixin template A()
{
	public void* getS()
	{
		return null;
	}
}

public interface I
{
	public void* getS();
	protected void getStruct();
}

void main() {}

// EOF ==========================================

// c.d ==========================================

private import b;

class C : B
{
	protected override void getStruct() {}
}

// EOF ==========================================


$ gdc -c -o b.o b.d
$ gdc -c -o c.o c.d
$ gdc -o test.o b.o c.o

ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here





October 24
On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
> 
>
> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here

BTW. DMD does not includes those _DT16_D1b1B8__mixin24getSMFZPv symbols (ddemangle even could not decode them) in obj files and ldc does include tham but with small differecies in name and have defined them as W (weak reference) not T(text/code) as gdc does
October 29
On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
> 
> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216