[Issue 15906] [REG2.068.1] GIT HEAD undefined references

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 14 04:38:38 PDT 2016


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure
            Summary|GIT HEAD undefined          |[REG2.068.1] GIT HEAD
                   |references                  |undefined references

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

////////////////////////////////////////
// test.d
import algo;
import file;

void main()
{
    [ `` ].map!(a => dirEntries(a).map!(a => a));
}

////////////////////////////////////////
// file.d
struct RefCounted(T)
{
    struct RefCountedStore
    {
        struct Impl
        {
            T _payload;
        }

        Impl* _store;
    }
    RefCountedStore _refCounted;

    inout(T) refCountedPayload() inout
    {
        return _refCounted._store._payload;
    }
    alias refCountedPayload this;
}

struct DirEntry {}

struct DirIteratorImpl {}

struct DirIterator
{
    RefCounted!(DirIteratorImpl) impl;
}

auto dirEntries(string)
{
    import algo;
    bool f(DirEntry de) { return true; }
    return filter!f(DirIterator());
}

////////////////////////////////////////
// algo.d
template unaryFun(alias fun)
{
    alias unaryFun = fun;
}

template ElementType(R)
{
    static if (is(typeof(R.init.front) T))
        alias ElementType = T;
}

T front(T)(T[] )
{
    return [];
}

template map(fun...)
{
    auto map(Range)(Range r)
    {
        alias RE = ElementType!Range;
        alias _fun = unaryFun!fun;
        assert(!is(typeof(_fun(RE.init))));
        return MapResult!(_fun, Range)(r);
    }
}

struct MapResult(alias fun, R)
{
    R _input;

    @property front()
    {
        fun(_input.front);
    }
}

template filter(alias pred)
{
    auto filter(R)(R )
    {
        return FilterResult!(pred, R)();
    }
}

struct FilterResult(alias pred, R)
{
    R _input;

    @property front()
    {
        return _input;
    }
}



Introduced in:
https://github.com/D-Programming-Language/dmd/pull/5001

--


More information about the Digitalmars-d-bugs mailing list