https://issues.dlang.org/show_bug.cgi?id=13610
--- Comment #1 from Don <[email protected]> --- (In reply to jens.k.mueller from comment #0) > 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 Of course it fails. array is an enum, it can never change. That's the point of enum! The confusing thing is that bringToFront compiles when passed a manifest constant. --
