[Issue 17155] [REG2.071.0] Link failure with nested map

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 11 17:16:12 PST 2017


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

--- Comment #1 from Vladimir Panteleev <thecybershadow at gmail.com> ---
Reduced:

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

struct MapResult(alias fun)
{
    void front()
    {
        fun(string.init);
    }
}

template map(fun...)
{
    auto map(string[])
    {
        alias _fun = unaryFun!fun;
        assert(!is(typeof(_fun(string.init))));
        return MapResult!(_fun)();
    }
}

struct Map2Result(Range)
{
    Range _input;
}

auto map2(Range)(Range)
{
    return Map2Result!Range();
}

struct FilterResult()
{
    string front;
}

auto dirEntries()
{
    return FilterResult!().init;
}
/////////////////////// test.d //////////////////////
import lib;

version (bug)
    auto x (T) (T mask) { return dirEntries().map2; }
else
    auto x(string mask) { return dirEntries().map2; }

void main()
{
    string[] files;
    files.map!(mask => x(mask));
}

////////////////////// test.sh //////////////////////
dmd -lib -oflib.a lib.d

dmd              test lib.a # OK

dmd -version=bug test lib.a # link error
/////////////////////////////////////////////////////


Output:

test.o: In function
`_D3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2Result9__xtoHashFNbNeKxS3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2ResultZm':
test.d:(.text._D3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2Result9__xtoHashFNbNeKxS3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2ResultZm+0x14):
undefined reference to
`_D49TypeInfo_xS3lib18__T12FilterResultZ12FilterResult6__initZ'
test.d:(.text._D3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2Result9__xtoHashFNbNeKxS3lib56__T10Map2ResultTS3lib18__T12FilterResultZ12FilterResultZ10Map2ResultZm+0x1b):
undefined reference to
`_D49TypeInfo_xS3lib18__T12FilterResultZ12FilterResult6__initZ'
collect2: error: ld returned 1 exit status

This is still a regression in 2.071.0, however, as with issue 15985, Digger's
bisection doesn't seem to point to anything useful.

--


More information about the Digitalmars-d-bugs mailing list