Merge remote-tracking branch 'upstream/stable' into merge_stable

This commit is contained in:
Iain Buclaw 2024-06-15 22:33:30 +00:00
commit 7ff7b842a8
2 changed files with 19 additions and 1 deletions

View file

@ -3873,6 +3873,21 @@ if (isInputRange!Range && !isInfinite!Range &&
assert([BigInt(2), BigInt(3)].maxElement == BigInt(3));
}
// https://issues.dlang.org/show_bug.cgi?id=24596
@safe unittest
{
static class A {
int i;
int getI() @safe => i;
this(int i) @safe { this.i = i; }
}
auto arr = [new A(2), new A(3)];
arr.maxElement!(a => a.getI);
assert(arr[0].getI == 2);
}
// minPos
/**
Computes a subrange of `range` starting at the first occurrence of `range`'s

View file

@ -3125,7 +3125,10 @@ private:
}
// call possible struct destructors
.destroy!(No.initialize)(*cast(T*) &this.data);
static if (is(T == struct))
{
.destroy!(No.initialize)(*cast(T*) &this.data);
}
}
}