[Issue 27] New: Undefined interface functions when inheriting from two sources.

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Mon Dec 3 19:08:55 PST 2012


http://gdcproject.org/bugzilla/show_bug.cgi?id=27

             Bug #: 27
           Summary: Undefined interface functions when inheriting from two
                    sources.
    Classification: Unclassified
           Product: GDC
           Version: development
          Platform: x86
        OS/Version: Other
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
        AssignedTo: ibuclaw at gdcproject.org
        ReportedBy: venix1 at gmail.com


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(){}

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.


More information about the D.gnu mailing list