www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12146] New: Linker error with __xopCmp, __xopEq, TypeInfo

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146

           Summary: Linker error with __xopCmp, __xopEq, TypeInfo
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu



cat > bar.d << CODE
struct Bar
{
    bool opCmp(ubyte val) { return false; }
}
CODE

cat > foo.d << CODE
import bar;

struct Appender
{
    Bar[] tokens; // references TypeInfo of Bar!(ubyte)
    // TypeInfo references __xopCmp
}

void main()
{
}
CODE

dmd -lib bar
dmd foo bar.a

----
foo.o:(.data._D18TypeInfo_S3bar3Bar6__initZ+0x40): undefined reference to
`_D3bar3Bar8__xopCmpFKxS3bar3BarKxS3bar3BarZi'
----

It seems, that during compilation of the bar lib the generated _xOpCmp function
isn't emitted to the object file.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146




I think this is caused by this change.
https://github.com/D-Programming-Language/dmd/pull/2582/files#diff-ffa5582af7d723c487d4a11ac6743b85L739

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



03:49:23 EET ---
Looks like a duplicate of bug 12144.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146




Also happens with a sensible opCmp, like

    int opCmp(const ref Bar) { return 0; }

It must deviate from the default signature though, i.e. can't be

    int opCmp(const ref Bar) const { return 0; }

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 12144 ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146




I think we should try to solve this by only creating one TypeInfo per struct,
but always generate it, when the struct is defined. If the TypeInfo is
referenced somewhere else, it will need to link against the module that defined
the struct.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12146


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



The root cause for this bug was, that the TypeInfo
for structs can only be generated after semantic3 for
that struct was run. This is not possible if the TypeInfo
is needed during the obj generation pass, e.g. because
it is referenced by an array TypeInfo.

https://github.com/D-Programming-Language/dmd/pull/3255

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2014