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

           Summary: A problem with std.algorithm.remove on array of fixed
                    size array
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-08-02 12:14:16 PDT ---
This program works:


import std.stdio: writeln;
import std.algorithm: remove, countUntil;
void main() {
    alias int[] P;
    P[] data = [[1, 2], [3, 4], [5, 6]];
    P x = [3, 4];
    data.remove(data.countUntil(x));
    data.length--;
    writeln(data);
}


Output:

[[1, 2], [5, 6]]



But this fails compiling:

//import std.stdio: writeln;
import std.algorithm: remove, countUntil;
void main() {
    alias int[2] P;
    P[] data = [[1, 2], [3, 4], [5, 6]];
    P x = [3, 4];
    data.remove(data.countUntil(x));
    data.length--;
//    writeln(data);
}



DMD 2.060beta gives:

core.exception.AssertError@std.algorithm(1342): Assertion failure
----------------
0x0040E284 in char[][] core.sys.windows.stacktrace.StackTrace.trace()
0x0040E10F in core.sys.windows.stacktrace.StackTrace
core.sys.windows.stacktrace.StackTrace.__ctor()
0x00409A2B in onAssertError
0x0040261F in int[2][] std.algorithm.moveAll!(int[2][],
int[2][]).moveAll(int[2][], int[2][]) at
...\dmd2\src\phobos\std\algorithm.d(1595)
0x0040245A in int[2][]
std.algorithm.__T6removeVE3std9algorithm12SwapStrategy2TAG2iTiZ.remove(int[2][],
int) at ...\dmd2\src\phobos\std\algorithm.d(6334)
0x004020F8 in _Dmain at C:\leonardo\d_bugs\bug.d(8)
0x00402B70 in extern (C) int rt.dmain2.main(int, char**).void runMain()
0x00402BAA in extern (C) int rt.dmain2.main(int, char**).void runAll()
0x004027CC in main
0x00414E7D in mainCRTStartup
0x7697D309 in BaseThreadInitThunk
0x76FB1603 in RtlInitializeExceptionChain
0x76FB15D6 in RtlInitializeExceptionChain

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

Reply via email to