www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9299] New: std.algorithm.minPos of const(int)[]

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jan 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com
         AssignedTo|nobody puremagic.com        |monarchdodra gmail.com


--- Comment #1 from monarchdodra gmail.com 2013-01-12 05:02:09 PST ---
Hum. This pull is related:

https://github.com/D-Programming-Language/phobos/commit/58fef77d02919f844b83b7de157420d9f8f8edda#L0R5498

It added support for non-LvalueRange, but broke support for immutables. I'll
fix it.

minCount also seems impacted :/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299



--- Comment #2 from bearophile_hugs eml.cc 2013-01-12 05:20:31 PST ---
(In reply to comment #1)

 It added support for non-LvalueRange, but broke support for immutables. I'll
 fix it.

Thank you. If you want to fix it, then I suggest to also add a good amount of unittests, to catch future related problem. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299



--- Comment #3 from monarchdodra gmail.com 2013-01-12 08:50:38 PST ---
https://github.com/D-Programming-Language/phobos/pull/1070

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299



--- Comment #4 from github-bugzilla puremagic.com 2013-01-13 16:21:06 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5afbfac8c50d1cc1ef2d211d1f09ca3c47a2d67f
Fixes issue 9299 - std.algorithm.minPos of const(int)[]

https://github.com/D-Programming-Language/phobos/commit/bdc959933c56d664d59bbd2ff4c911f7e50c490a
Merge pull request #1070 from monarchdodra/9299

Fixes issue 9299 - std.algorithm.minPos of const(int)[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299


Alex Rønne Petersen <alex lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex lycus.org
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9299



--- Comment #5 from bearophile_hugs eml.cc 2013-01-13 21:05:06 PST ---
(In reply to comment #1)

 minCount also seems impacted :/

I have created Issue 9314 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 13 2013