mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +03:00
Merge branch 'master' into string
This commit is contained in:
commit
cfedd9feb1
2 changed files with 11 additions and 0 deletions
|
@ -19,5 +19,6 @@ $(VERSION 054, ddd mm, 2011, =================================================,
|
||||||
$(LI $(BUGZILLA 5857): std.regex (...){n,m} is bogus when (...) contains repetitions)
|
$(LI $(BUGZILLA 5857): std.regex (...){n,m} is bogus when (...) contains repetitions)
|
||||||
$(LI $(BUGZILLA 6076): regression, std.regex: "c.*|d" matches "mm")
|
$(LI $(BUGZILLA 6076): regression, std.regex: "c.*|d" matches "mm")
|
||||||
$(LI $(BUGZILLA 6113): singletons in std.datetime are not created early enough)
|
$(LI $(BUGZILLA 6113): singletons in std.datetime are not created early enough)
|
||||||
|
$(LI $(BUGZILLA 5705): Swapping identical struct with hasElaborateAssign causes "overlapping array copy" exception)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1479,6 +1479,7 @@ if (isMutable!T && !is(typeof(T.init.proxySwap(T.init))))
|
||||||
{
|
{
|
||||||
static if (hasElaborateAssign!T)
|
static if (hasElaborateAssign!T)
|
||||||
{
|
{
|
||||||
|
if (lhs !is rhs) {
|
||||||
// For structs with non-trivial assignment, move memory directly
|
// For structs with non-trivial assignment, move memory directly
|
||||||
// First check for undue aliasing
|
// First check for undue aliasing
|
||||||
assert(!pointsTo(lhs, rhs) && !pointsTo(rhs, lhs)
|
assert(!pointsTo(lhs, rhs) && !pointsTo(rhs, lhs)
|
||||||
|
@ -1491,6 +1492,7 @@ if (isMutable!T && !is(typeof(T.init.proxySwap(T.init))))
|
||||||
a[] = b[];
|
a[] = b[];
|
||||||
b[] = t[];
|
b[] = t[];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Temporary fix Bug 4789. Wor around the fact that assigning a static
|
// Temporary fix Bug 4789. Wor around the fact that assigning a static
|
||||||
|
@ -1553,6 +1555,10 @@ unittest
|
||||||
swap(nc1, nc2);
|
swap(nc1, nc2);
|
||||||
assert(nc1.n == 513 && nc1.s == "uvwxyz");
|
assert(nc1.n == 513 && nc1.s == "uvwxyz");
|
||||||
assert(nc2.n == 127 && nc2.s == "abc");
|
assert(nc2.n == 127 && nc2.s == "abc");
|
||||||
|
swap(nc1, nc1);
|
||||||
|
swap(nc2, nc2);
|
||||||
|
assert(nc1.n == 513 && nc1.s == "uvwxyz");
|
||||||
|
assert(nc2.n == 127 && nc2.s == "abc");
|
||||||
|
|
||||||
struct NoCopyHolder
|
struct NoCopyHolder
|
||||||
{
|
{
|
||||||
|
@ -1564,6 +1570,10 @@ unittest
|
||||||
swap(h1, h2);
|
swap(h1, h2);
|
||||||
assert(h1.noCopy.n == 65 && h1.noCopy.s == null);
|
assert(h1.noCopy.n == 65 && h1.noCopy.s == null);
|
||||||
assert(h2.noCopy.n == 31 && h2.noCopy.s == "abc");
|
assert(h2.noCopy.n == 31 && h2.noCopy.s == "abc");
|
||||||
|
swap(h1, h1);
|
||||||
|
swap(h2, h2);
|
||||||
|
assert(h1.noCopy.n == 65 && h1.noCopy.s == null);
|
||||||
|
assert(h2.noCopy.n == 31 && h2.noCopy.s == "abc");
|
||||||
|
|
||||||
const NoCopy const1, const2;
|
const NoCopy const1, const2;
|
||||||
static assert(!__traits(compiles, swap(const1, const2)));
|
static assert(!__traits(compiles, swap(const1, const2)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue