[Issue 9792] length field of a const SortedRange

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 26 23:00:06 UTC 2020


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

Ali Cehreli <acehreli at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acehreli at yahoo.com

--- Comment #3 from Ali Cehreli <acehreli at yahoo.com> ---
I ran into this in a post condition code:

import std.algorithm;

auto foo()
out (result; result.length == 1) { // <-- ERROR
  return [ 0 ].sort;
}

void main() {
}

Error: mutable method `std.range.SortedRange!(int[], "a <
b").SortedRange.length` is not callable using a `const` object
Consider adding `const` or `inout` to std.range.SortedRange!(int[], "a <
b").SortedRange.length

Ali

--


More information about the Digitalmars-d-bugs mailing list