[Issue 20968] Linker error of uninstantiated templated `opEquals` member of struct when compiled with -preview=in

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 21 22:51:12 UTC 2020


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

--- Comment #1 from Per Nordlöw <per.nordlow at gmail.com> ---
Same linker error is triggered when replacing `opEquals` with `opCmp` as with


Rational!(I1) rational(I1, I2)(I1 , I2)
{
    return typeof(return)();
}

struct Rational(Int)
{
    bool opCmp(Rhs)(Rhs _) {}
}

@nogc unittest
{
    auto _ = rational(1, 2);
}


instead fails to link as

rational.o:__main.d:_D36TypeInfo_S8rational__T8RationalTiZQm6__initZ: error:
undefined reference to '_D6object7_xopCmpFMxPvMxQeZb'

--


More information about the Digitalmars-d-bugs mailing list