In CTFE it seems. Only tested with DMD on Windows though. Is this a known limitation, or a bug, I couldn't find anything that seemed to match it in the bugzilla.

import std.array;

struct DataAndView
{
        int[] data, view;

        this(int x)
        {
                data = [1, 2, 3, 4, 5];
                view = data[x .. $];
        }
}

unittest
{
        auto a = DataAndView(1);
        assert (sameTail(a.data, a.view));
        enum b = DataAndView(1);
        assert (!sameTail(b.data, b.view));
}

Reply via email to