aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/algorithm
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 14:24:49 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 14:24:49 +0100
commita676a516701789730aa482bcef4adcb683ba0140 (patch)
tree6c5b56d13162e537bae0ed373a9addf9be73af56 /libphobos/src/std/algorithm
parent3dfad340cb140d64b8c0ecab05fa329238ebd06b (diff)
downloadgcc-a676a516701789730aa482bcef4adcb683ba0140.zip
gcc-a676a516701789730aa482bcef4adcb683ba0140.tar.gz
gcc-a676a516701789730aa482bcef4adcb683ba0140.tar.bz2
d: Merge upstream dmd, druntime 07bc5b9b3c, phobos de1dea109
Synchronizing with the upstream release of v2.109.0. D front-end changes: - Import dmd v2.109.0. D runtime changes: - Import druntime v2.109.0. Phobos changes: - Import phobos v2.109.0. gcc/d/ChangeLog: * decl.cc (DeclVisitor::finish_vtable): Update for new front-end interface. * dmd/MERGE: Merge upstream dmd 07bc5b9b3c. * dmd/VERSION: Bump version to v2.109.0. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 07bc5b9b3c. * src/MERGE: Merge upstream phobos de1dea109.
Diffstat (limited to 'libphobos/src/std/algorithm')
-rw-r--r--libphobos/src/std/algorithm/searching.d15
1 files changed, 15 insertions, 0 deletions
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index 2d89dea..42a9df5 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -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