Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help compiler deduce pure for moveEmplaceImpl #7670

Closed
wants to merge 2 commits into from
Closed
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
22 changes: 21 additions & 1 deletion std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ private T trustedMoveImpl(T)(ref T source) @trusted
move(x, x);
}

private void moveEmplaceImpl(T)(ref T source, ref T target)
private void moveEmplaceImpl(T)(ref T source, ref T target) pure
{
import core.stdc.string : memcpy, memset;
import std.traits : hasAliasing, hasElaborateAssign,
Expand Down Expand Up @@ -1517,6 +1517,26 @@ pure nothrow @nogc @system unittest
f(move(ncarray));
}

// https://issues.dlang.org/show_bug.cgi?id=21202
unittest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add attributes for the unittest block?

{
static struct Strukt2
{
this(int* _block) { }
}

static struct Strukt
{
int* block;
Strukt2 foo() { return Strukt2(null); }
alias foo this;
}

Strukt a;
Strukt b;
moveEmplace(a, b);
}

// moveAll
/**
Calls `move(a, b)` for each element `a` in `src` and the corresponding
Expand Down