[Issue 13919] typeof(T.init[].front.init) crashes compiler for T = std.container.Array!int

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jan 19 17:54:21 PST 2015


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|enhancement                 |major

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
Reduced test case:

alias T = Array!int;
pragma(msg, typeof(T.init[].front.init));

struct RefCounted(T)
{
    //struct RefCountedStore
    //{
        struct Impl
        {
            T _payload;
            size_t _count;
        }

        Impl* _store;
    //}
    //RefCountedStore _refCounted;

    ~this() {}  // necessary

    @property ref inout(T) refCountedPayload() inout
    {
        return /*_refCounted.*/_store._payload;
    }

    alias refCountedPayload this;
}

struct Array(T)
{
    struct Payload
    {
        size_t _capacity;
        T[] _payload;
    }
    RefCounted!Payload _data;

    static struct Range
    {
        Array _outer;

        this(ref Array data)    // necessary
        {
            //_outer = data;
        }

        @property ref T front()
        {
            return _outer._data._payload[_a];
        }
    }

    Range opSlice()
    {
        return Range(this);
    }
}

--


More information about the Digitalmars-d-bugs mailing list