www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10425] New: Link error with templates

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

           Summary: Link error with templates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: siegelords_abode yahoo.com


--- Comment #0 from siegelords_abode yahoo.com 2013-06-20 09:05:03 PDT ---
DMD version 2.063.0 through .2. Worked ok in 2.062. 32/64 bit Linux.

This needs two files, test.d and bug.d
///////////
module test;

import bug;

void main()
{

}

///////////
module bug;

struct A()
{
    int opCmp(const ref A p) const
    {
        return 0;
    }

    string toString()
    {
        return "";
    }
}

struct B()
{
    void foo()
    {
        auto a = new A!();
    }
}

struct C
{
    alias A!() a_t;

    this(B!() b)
    {

    }
}

When compiled this way there are no errors:

dmd test.d bug.d

However, when compiled this way I get link errors:

dmd -c bug.d && dmd test.d bug.o

test2.o:(.data._D23TypeInfo_S3bug6__T1AZ1A6__initZ+0x40): undefined reference
to `_D3bug6__T1AZ1A5opCmpMxFKxS3bug6__T1AZ1AZi'
test2.o:(.data._D23TypeInfo_S3bug6__T1AZ1A6__initZ+0x48): undefined reference
to `_D3bug6__T1AZ1A8toStringMFZAya'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 20 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-20
09:30:06 PDT ---
Tried on Windows but it works there, it's maybe a posix-only issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 20 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx
         OS/Version|All                         |Linux


--- Comment #2 from hsteoh quickfur.ath.cx 2013-06-29 11:03:51 PDT ---
Reproduced this problem on my Linux amd64 box with dmd git HEAD.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425



--- Comment #3 from hsteoh quickfur.ath.cx 2013-06-29 11:42:04 PDT ---
git bisect indicates that the offending commit was
67fbf5753e9d4a276c354e952ed2f888efcb714c, which was apparently a fix for issue
7511.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 29 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425


Kenji Hara <k.hara.pg gmail.com> changed:

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


--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2013-09-21 21:39:47 PDT ---
The link-failure could see also on Windows 64bit codegen (use -m64).

dmd -m64 -c bug.d && dmd -m64 test.d bug.obj


Compiler fix:
https://github.com/D-Programming-Language/dmd/pull/2582

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425



--- Comment #5 from github-bugzilla puremagic.com 2013-09-24 23:55:35 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/19ee7cb21fdbe52d6d773698ca5474922d43457b
fix Issue 10425 - Link error with templates

https://github.com/D-Programming-Language/dmd/commit/80e75140c569d7a2bd9b402dff42eef140c748cf
Merge pull request #2582 from 9rnsr/fix10425

[REG2.062] Issue 10425 - Link error with templates

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10425


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 24 2013