[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-25 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 ag0ae...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #2 from Atila Neves --- You're right, it's not a bug. I should probably not file things late at night when I can't think anymore. The ref thing should've been obvious. However, even with ref, the explanation isn't quite right: the delega

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #3 from Atila Neves --- Ok, I've looked into it a bit more and I think it's a bug. I @disabled this(this) and it still happens. The worse part is the length of the slice seems to be garbage as well: this(ref T func) { _returns =

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-26 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #4 from ag0ae...@gmail.com --- (In reply to Atila Neves from comment #2) > However, even with ref, the explanation isn't quite right: the delegate > created in the constructor doesn't reference garbage - the GC should keep > the memory ali

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #5 from Atila Neves --- At least there's a workaround: auto m = Mock!T(...); return m; I believe that the fact that this behaviour is different from the original implementation is a compiler bug and would ask for this to reopened. Also

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #6 from ag0ae...@gmail.com --- (In reply to Atila Neves from comment #5) > At least there's a workaround: > > auto m = Mock!T(...); > return m; > > I believe that the fact that this behaviour is different from the original > implementati

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #7 from Atila Neves --- In the following code, the length is garbage, and uncommenting an assert makes the problem move! import std.traits; import std.conv; int delegate(int) dg; static this() { dg = i => i * 2; } struct MockSco

[Issue 15832] Crashing program when a helper template function is used to create a template struct

2016-03-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15832 --- Comment #8 from ag0ae...@gmail.com --- (In reply to Atila Neves from comment #7) > In the following code, the length is garbage, and uncommenting an assert > makes the problem move! I think a garbage reference to the stack explains this well. Any