On Friday, 8 March 2013 at 16:25:56 UTC, deadalnix wrote:
Sooooooo,

I have a struct. The struct have a context pointer. I have this method :

@property
auto save() inout {
        return inout(Lexer)(t, r.save, line, index);
}

The context pointer IS NOT COPIED.

Fixed it that way :

@property
auto save() inout {
        // XXX: dmd bug, context pointer isn't copied properly
        // doing it manualy using black magic.
// Context pointer is the last element of the struct. Here in position 9.
        auto ret = inout(Lexer)(t, r.save, line, index);
        (cast(void**) &ret)[9] = (cast(void**) &this)[9];
        
        return ret;
}

Very scary that I have to do that kind of things.

Is this a know bug ? Come on, this is a really bad bug, not the type of thing that can be ignored !

Reply via email to