Ranges and Library and toir.c internal error

bearophile bearophileHUGS at lycos.com
Wed Oct 31 18:25:17 PDT 2012


StupidIsAsStupidDoes:

> The char call doesn't compile and I get a toir.c internal error.

Such internal errors are compiler bugs that should be added to 
Bugzilla.

But I have compiled the following program with the latest DMD 
GIT-head 32 bit Windows, and I see no compiler bugs:


import std.algorithm: count;

int countBetween(T)(T[] x, T low, T high) {
     return x.count!(x => x >= low && x <= high)();
}

void main() {
     int[] a = [9, 77, 1, 13, 76, 17, 4, 27, 99, 5];
     auto m = countBetween(a, 1, 25);

     char[] b = ['h', 'e', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'];
     auto n = countBetween(b, 'c', 'k');
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list