Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ if (areCopyCompatibleArrays!(SourceRange, TargetRange))
assert(tlen >= slen,
"Cannot copy a source range into a smaller target range.");

immutable overlaps = () @trusted {
immutable overlaps = __ctfe || () @trusted {
return source.ptr < target.ptr + tlen &&
target.ptr < source.ptr + slen; }();

Expand Down Expand Up @@ -486,6 +486,14 @@ $(HTTP sgi.com/tech/stl/copy_backward.html, STL's copy_backward'):
assert(dest == [0, 0, 1, 2, 4]);
}

// Test CTFE copy.
@safe unittest
{
enum c = copy([1,2,3], [4,5,6,7]);
assert(c == [7]);
}


@safe unittest
{
import std.algorithm.iteration : filter;
Expand Down