www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9101] New: template mixin constructor causes link error

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

           Summary: template mixin constructor causes link error
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de



PST ---
With latest dmd from github, this code produces a link error:

class Node
{
    int id;

    this()
    {
    }

    this(int tok)
    {
        id = tok;
    }

    mixin template ForwardCtorNoId()
    {
        this() {} // default constructor needed for clone()

        this(int tok)
        {
            super(tok);
        }
    }
}

class Derived : Node
{
    mixin ForwardCtorNoId!();
}


void main()
{
}

This does not happen with dmd 2.060 and using bisect, it seems to be introduced
with this commit: 8bc59cfe8e6896435f20ce1e9bdcc226942f59a8 fix Issue 5893 -
Allow simple aliases for operator overloading

A work around seems to be to move the mixin declaration out of the base class
scope.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101




PST ---
Forgot to post the error message:

dmd.exe test.d
OPTLINK (R) for Win32 Release 8.00.11 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined _D4test4Node21__T15ForwardCtorNoIdZ6__ctorMFZC4test4 Node --- errorlevel 1 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101





 This does not happen with dmd 2.060 and using bisect, it seems to be introduced
 with this commit: 8bc59cfe8e6896435f20ce1e9bdcc226942f59a8 fix Issue 5893 -
 Allow simple aliases for operator overloading
 
 A work around seems to be to move the mixin declaration out of the base class
 scope.
(2888ec4) doesn't occur such link error in Windows. But, in current I use optlink 8.00.5 > link OPTLINK (R) for Win32 Release 8.00.5 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html Might this be a optkink bug? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 04 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101




PST ---
It's not the linker, the symbol is referenced from within the object file.

The problem is triggered by my precise GC patches in druntime where generation
of RTInfo needs to iterate over the members of the class. The bad operation
boils down to

static if (__traits(compiles, Node.ForwardCtorNoId.offset+1)) {}

When added to the test case, the error appears with the standard druntime, too.
The derived class is not needed then.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 05 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101





 It's not the linker, the symbol is referenced from within the object file.
 
 The problem is triggered by my precise GC patches in druntime where generation
 of RTInfo needs to iterate over the members of the class. The bad operation
 boils down to
 
 static if (__traits(compiles, Node.ForwardCtorNoId.offset+1)) {}
 
 When added to the test case, the error appears with the standard druntime, too.
 The derived class is not needed then.
OK, the original case has been broken by fixing issue 5893 certainly. But following shrinked code causes same linker error, and it has been caused same linker error from before fixing 5893. ---- class Node { template ForwardCtorNoId() { this() {} // default constructor void foo() { 0 = 1; } // wrong code } } enum x = __traits(compiles, Node.ForwardCtorNoId!()); void main() {} ---- Therefore, the root cause was not a regression. But your code actually be broken in 2.061head. So I'd like to keep this issue marked as regression. Thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure, pull



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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 12 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9e36de3edaabe74c7f81f1ebe563ecd8186c960c
fix Issue 9101 - template mixin constructor causes link error

https://github.com/D-Programming-Language/dmd/commit/c4dc64092ae2ae8d774ae5d9b2af5b440dfff40f


Issue 9101 - template mixin constructor causes link error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 12 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9101


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: -------
Dec 12 2012