GDC bug? duplicates symbols when using mixin and interface

Daniel Kozak kozzi11 at gmail.com
Thu Oct 24 11:05:21 UTC 2019


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







More information about the D.gnu mailing list