Thread overview
[Issue 17155] [REG2.071.0] Link failure with nested map
Feb 07, 2017
Vladimir Panteleev
Feb 12, 2017
Vladimir Panteleev
Feb 12, 2017
Vladimir Panteleev
February 07, 2017
https://issues.dlang.org/show_bug.cgi?id=17155

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[REG2.071.0]                |[REG2.071.0] Link failure
                   |                            |with nested map

--
February 12, 2017
https://issues.dlang.org/show_bug.cgi?id=17155

--- Comment #1 from Vladimir Panteleev <thecybershadow@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.

--
February 12, 2017
https://issues.dlang.org/show_bug.cgi?id=17155

--- Comment #2 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Vladimir Panteleev from comment #1)
> 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.

OK, I got Digger to bisect the stable branch properly.

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

--