www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 311] New: Multiple definition when not overriding everything

https://bugzilla.gdcproject.org/show_bug.cgi?id=311

            Bug ID: 311
           Summary: Multiple definition when not overriding everything
           Product: GDC
           Version: 8,x
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw gdcproject.org
          Reporter: alex sunopti.com

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

-- 
You are receiving this mail because:
You are watching all bug changes.
Mar 03 2019