View mode: basic / threaded / horizontal-split · Log in · Help
January 05, 2013
[Issue 9273] New: DMD Segfaulting with templated ctors
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


--- Comment #0 from David <admin@dav1d.de> 2013-01-05 07:27:19 PST ---
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: -------
January 05, 2013
[Issue 9273] DMD Segfaulting with templated ctors
http://d.puremagic.com/issues/show_bug.cgi?id=9273



--- Comment #1 from David <admin@dav1d.de> 2013-01-05 07:33:08 PST ---
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: -------
January 09, 2013
[Issue 9273] DMD Segfaulting with templated ctors
http://d.puremagic.com/issues/show_bug.cgi?id=9273


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

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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-08 23:18:23 PST ---
A simplified test case:
---
template CtorMixin() {
   this(T)() {}
}
class B {
   mixin CtorMixin!();
}
class C : B {
   this()() {}
}
void main() {
   auto c = new C();
}
---

(In reply to comment #0)
> 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: -------
January 09, 2013
[Issue 9273] DMD Segfaulting with templated ctors
http://d.puremagic.com/issues/show_bug.cgi?id=9273



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-08 23:23:59 PST ---
*** 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: -------
January 09, 2013
[Issue 9273] DMD Segfaulting with templated ctors
http://d.puremagic.com/issues/show_bug.cgi?id=9273



--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-08 23:25:22 PST ---
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: -------
January 09, 2013
[Issue 9273] DMD segfaults with templated ctors in implicit super call
http://d.puremagic.com/issues/show_bug.cgi?id=9273


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

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


--- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-08 23:54:39 PST ---
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: -------
January 09, 2013
[Issue 9273] DMD segfaults with templated ctors in implicit super call
http://d.puremagic.com/issues/show_bug.cgi?id=9273



--- Comment #6 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-09 03:39:54 PST ---
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
Merge pull request #1451 from 9rnsr/fix9273

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: -------
January 09, 2013
[Issue 9273] DMD segfaults with templated ctors in implicit super call
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: -------
Top | Discussion index | About this forum | D home