October 13, 2014 [Issue 13610] New: bringToFront does not work with CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13610 Issue ID: 13610 Summary: bringToFront does not work with CTFE Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: Phobos Assignee: nobody@puremagic.com Reporter: jens.k.mueller@gmx.de bringToFront does not work with CTFE. I don't know whether it is supposed to but it certainly is surprising. import std.algorithm : bringToFront; // at running time { auto array = [1, 2, 3, 4]; bringToFront(array[0 .. $-1], array[$-1 .. $]); assert(array == [4, 1, 2, 3]); } // at compile time { enum array = [1, 2, 3, 4]; bringToFront(array[0 .. $-1], array[$-1 .. $]); static assert(array == [4, 1, 2, 3]); // fails } says Error: static assert ([1, 2, 3, 4] == [4, 1, 2, 3]) is false I used dmd v2.066.0 on Linux. -- |
Copyright © 1999-2021 by the D Language Foundation