Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 311 - Multiple definition when not overriding everything
Summary: Multiple definition when not overriding everything
Status: NEW
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 8,x
Hardware: x86_64 Linux
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2019-03-04 03:05 CET by Alex
Modified: 2019-03-04 03:05 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2019-03-04 03:05:02 CET
gdc --version = gdc (Debian 8.2.0-21) 8.2.0

Multiple symbols when linking derived class with partial override.

File named a.d:

interface A
{
	bool m1();
	bool m2();
}

class AA : A
{
	override bool m1() { return true; }
	override bool m2()
	{
		return true;
	}
}

File named b.d:

import std.stdio;
import a;


class B : AA
{
	override bool m2()
	{
		return true;
	}
}

void main()
{
	auto b = new B;
	writefln("%s",b.m2);
}

Command line :

gdc -c a.d
gdc -c b.d
gdc a.o b.o

/usr/bin/ld: b.o: in function `_DT16_D1a2AA2m1MFZb':
b.d:(.text+0x122): multiple definition of `_DT16_D1a2AA2m1MFZb'; a.o:a.d:(.text+0x71): first defined here

No error if compiled all at once:

gdc a.d b.d