[Issue 13610] New: bringToFront does not work with CTFE
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 13 04:17:50 PDT 2014
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 at puremagic.com
Reporter: jens.k.mueller at 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.
--
More information about the Digitalmars-d-bugs
mailing list