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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Mar 26 03:27:50 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15832

--- Comment #3 from Atila Neves <atila.neves at gmail.com> ---
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 = [ReturnType!T.init];
        ReturnType!T inner(ParameterTypeTuple!T values) {
            auto ret = _returns[0];
            import std.conv: to;
            assert(_returns.length < 10, "Weird length: " ~
_returns.length.to!string);
            // the next line causes length to be incredibly large, i.e. gargabe
            if(_returns.length > 1) _returns = _returns[1..$];
            return ret;
        }
        func = &inner;
        _scope = MockScope!(T)(func, &inner);
    }

--


More information about the Digitalmars-d-bugs mailing list