mirror of
https://github.com/dlang/phobos.git
synced 2025-05-04 09:00:22 +03:00
Fix second move overload for issue 13990
This commit is contained in:
parent
523e8e5a41
commit
8ccd882556
1 changed files with 8 additions and 1 deletions
|
@ -949,7 +949,7 @@ T move(T)(ref T source)
|
||||||
hasElaborateCopyConstructor, hasElaborateDestructor,
|
hasElaborateCopyConstructor, hasElaborateDestructor,
|
||||||
isAssignable;
|
isAssignable;
|
||||||
|
|
||||||
static if (hasAliasing!T) if (!__ctfe)
|
static if (!is(T == class) && hasAliasing!T) if (!__ctfe)
|
||||||
{
|
{
|
||||||
import std.exception : doesPointTo;
|
import std.exception : doesPointTo;
|
||||||
assert(!doesPointTo(source, source), "Cannot move object with internal pointer.");
|
assert(!doesPointTo(source, source), "Cannot move object with internal pointer.");
|
||||||
|
@ -1041,6 +1041,13 @@ unittest
|
||||||
S4 s42 = move(s41);
|
S4 s42 = move(s41);
|
||||||
assert(s41.x.n == 0);
|
assert(s41.x.n == 0);
|
||||||
assert(s42.x.n == 1);
|
assert(s42.x.n == 1);
|
||||||
|
|
||||||
|
// Issue 13990 test
|
||||||
|
class S5;
|
||||||
|
|
||||||
|
S5 s51;
|
||||||
|
static assert(__traits(compiles, s51 = move(s51)),
|
||||||
|
"issue 13990, cannot move opaque class reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
unittest//Issue 6217
|
unittest//Issue 6217
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue