mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
Fix issue 13990, Now you can move opaque classes.
This commit is contained in:
parent
9c26b67f4f
commit
0afa52f599
1 changed files with 7 additions and 1 deletions
|
@ -2442,7 +2442,7 @@ void move(T)(ref T source, ref T target)
|
|||
{
|
||||
import core.stdc.string : memcpy;
|
||||
|
||||
static if (hasAliasing!T) if (!__ctfe)
|
||||
static if (!is( T == class) && hasAliasing!T) if (!__ctfe)
|
||||
{
|
||||
import std.exception : doesPointTo;
|
||||
assert(!doesPointTo(source, source), "Cannot move object with internal pointer.");
|
||||
|
@ -2535,6 +2535,12 @@ unittest
|
|||
move(s41, s42);
|
||||
assert(s41.x.n == 0);
|
||||
assert(s42.x.n == 1);
|
||||
|
||||
// Issue 13990 test
|
||||
class S5;
|
||||
|
||||
S5 s51;
|
||||
static assert(__traits(compiles, move(s51, s51)), "issue 13990, cannot move opaque class reference");
|
||||
}
|
||||
|
||||
/// Ditto
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue