www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9273] New: DMD Segfaulting with templated ctors

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

           Summary: DMD Segfaulting with templated ctors
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: admin dav1d.de



class NBTFile : TAG_Compound {
}

template _Base_TAG(int id_, DType_) {
this(T)() {
}

}

class TAG {
}


class TAG_Compound {
mixin _Base_TAG!(10, TAG);

}

This segfaults dmd, it's a dustmite reduction the whole code compiled under
2.060 so I guess it's a regression.

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




To make it even better:

Compiles:
---------------------------------------
class NBTFile : TAG_Compound {
    this()() {}
}

template _Base_TAG(int id_, DType_) {
this(T)() {
}

}

struct TAG {}

class TAG_Compound {
mixin _Base_TAG!(10, TAG);

}
---------------------------------------

Fails:
---------------------------------------
class NBTFile : TAG_Compound {
    this()() {}
}

template _Base_TAG(int id_, DType_) {
this(T)() {
}

}

struct TAG {}

class TAG_Compound {
mixin _Base_TAG!(10, TAG);

}

void main() {
    NBTFile s = new NBTFile();
}
---------------------------------------

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice



A simplified test case:
---
template CtorMixin() {
    this(T)() {}
}
class B {
    mixin CtorMixin!();
}
class C : B {
    this()() {}
}
void main() {
    auto c = new C();
}
---


 This segfaults dmd, it's a dustmite reduction the whole code compiled under
 2.060 so I guess it's a regression.
I think it is an accepts-invalid code in 2.060 and earlier. In class NBTFile, implicitly generated default constructor will try to call super class default constructor. But, in its super class TAG_Compound, template constructor - which mixed in by _Base_TAG - requires explicit template parameter to call. Therefore, the generating an implicit constructor in NBTFile and whole compilation should fail. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9273




*** Issue 8768 has been marked as a duplicate of this issue. ***

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




Most simple test case from bug 8768.

---
class A {    
    this(T)() {}
}
class B : A {
    this() {}
}
----

B.this() cannot call A.this(T)() implicitly.

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


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

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



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

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




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

https://github.com/D-Programming-Language/dmd/commit/1c8305dbf70dafb1528b73c317108fb2901eb604
fix Issue 9284 - DMD segfaults with templated ctors in constructor delegation

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


Issue 9273 & 9284 - DMD segfaults with templated ctors

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


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

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


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