[Issue 6447] iota(BigInt) too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 5 10:22:47 UTC 2018


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

Russel Winder <russel at winder.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #17 from Russel Winder <russel at winder.org.uk> ---
Using LDC on Debian Sid, the code:

import std.bigint: BigInt;
import std.range: iota;
void main() {
    auto x = iota(BigInt(10));
}

compiles and executes fine, but the code:

void main() {
    import std.bigint: BigInt;
    import std.range: iota;
    iota(BigInt(1), BigInt(100), BigInt(5));
    iota(BigInt(1), BigInt(100), 5);
}

results in:

test_b.d(4): Error: template std.range.iota cannot deduce function from
argument types !()(BigInt, BigInt, BigInt), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5371):       
std.range.iota(B, E, S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B,
E)) || isPointer!(CommonType!(B, E))) && isIntegral!S)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5481):       
std.range.iota(B, E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E)))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5488):       
std.range.iota(B, E)(B begin, E end) if (isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E)))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5558):       
std.range.iota(E)(E end) if (is(typeof(iota(E(0), end))))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5567):       
std.range.iota(B, E, S)(B begin, E end, S step) if
(isFloatingPoint!(CommonType!(B, E, S)))
test_b.d(4):        ... (1 more, -v to show) ...
test_b.d(5): Error: template std.range.iota cannot deduce function from
argument types !()(BigInt, BigInt, int), candidates are:
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5371):       
std.range.iota(B, E, S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B,
E)) || isPointer!(CommonType!(B, E))) && isIntegral!S)
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5481):       
std.range.iota(B, E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E)))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5488):       
std.range.iota(B, E)(B begin, E end) if (isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E)))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5558):       
std.range.iota(E)(E end) if (is(typeof(iota(E(0), end))))
/usr/lib/ldc/x86_64-linux-gnu/include/d/std/range/package.d(5567):       
std.range.iota(B, E, S)(B begin, E end, S step) if
(isFloatingPoint!(CommonType!(B, E, S)))
test_b.d(5):        ... (1 more, -v to show) ...


Using dmd from d-apt the first code works fine and the second code results in:

test_b.d(4): Error: template `std.range.iota` cannot deduce function from
argument types `!()(BigInt, BigInt, BigInt)`, candidates are:
/usr/include/dmd/phobos/std/range/package.d(5890):        `std.range.iota(B, E,
S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E))) && isIntegral!S)`
/usr/include/dmd/phobos/std/range/package.d(6000):        `std.range.iota(B,
E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E)))`
/usr/include/dmd/phobos/std/range/package.d(6007):        `std.range.iota(B,
E)(B begin, E end) if (isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E)))`
/usr/include/dmd/phobos/std/range/package.d(6077):        `std.range.iota(E)(E
end) if (is(typeof(iota(E(0), end))))`
/usr/include/dmd/phobos/std/range/package.d(6086):        `std.range.iota(B, E,
S)(B begin, E end, S step) if (isFloatingPoint!(CommonType!(B, E, S)))`
test_b.d(4):        ... (1 more, -v to show) ...
test_b.d(5): Error: template `std.range.iota` cannot deduce function from
argument types `!()(BigInt, BigInt, int)`, candidates are:
/usr/include/dmd/phobos/std/range/package.d(5890):        `std.range.iota(B, E,
S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E))) && isIntegral!S)`
/usr/include/dmd/phobos/std/range/package.d(6000):        `std.range.iota(B,
E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E)))`
/usr/include/dmd/phobos/std/range/package.d(6007):        `std.range.iota(B,
E)(B begin, E end) if (isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E)))`
/usr/include/dmd/phobos/std/range/package.d(6077):        `std.range.iota(E)(E
end) if (is(typeof(iota(E(0), end))))`
/usr/include/dmd/phobos/std/range/package.d(6086):        `std.range.iota(B, E,
S)(B begin, E end, S step) if (isFloatingPoint!(CommonType!(B, E, S)))`
test_b.d(5):        ... (1 more, -v to show) ...

So I think this problem is not fixed.

--


More information about the Digitalmars-d-bugs mailing list