[Issue 9299] New: std.algorithm.minPos of const(int)[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 12 02:40:55 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9299

           Summary: std.algorithm.minPos of const(int)[]
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-01-12 02:40:50 PST ---
import std.algorithm: minPos;
void main() {
    const(int)[] a1 = [2, 3, 1, 4];
    assert(minPos(a1) == [1, 4]);
    immutable int[] a2 = [2, 3, 1, 4];
    assert(minPos(a2) == [1, 4]);
}


DMD 2.062alpha gives:

...\dmd2\src\phobos\std\algorithm.d(1489): Error: cannot modify const
expression target
...\dmd2\src\phobos\std\algorithm.d(6183): Error: template instance
std.algorithm.move!(const(int)) error instantiating
test.d(4):        instantiated from here: minPos!("a < b", const(int)[])
test.d(4): Error: template instance std.algorithm.minPos!("a < b",
const(int)[]) error instantiating
...\dmd2\src\phobos\std\algorithm.d(1489): Error: cannot modify immutable
expression target
...\dmd2\src\phobos\std\algorithm.d(6183): Error: template instance
std.algorithm.move!(immutable(int)) error instantiating
test.d(6):        instantiated from here: minPos!("a < b", immutable(int)[])
test.d(6): Error: template instance std.algorithm.minPos!("a < b",
immutable(int)[]) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list