File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3873,6 +3873,21 @@ if (isInputRange!Range && !isInfinite!Range &&
3873
3873
assert ([BigInt(2 ), BigInt(3 )].maxElement == BigInt(3 ));
3874
3874
}
3875
3875
3876
+ // https://issues.dlang.org/show_bug.cgi?id=24596
3877
+ @safe unittest
3878
+ {
3879
+ static class A {
3880
+ int i;
3881
+ int getI () @safe => i;
3882
+ this (int i) @safe { this .i = i; }
3883
+ }
3884
+ auto arr = [new A(2 ), new A(3 )];
3885
+
3886
+ arr.maxElement! (a => a.getI);
3887
+
3888
+ assert (arr[0 ].getI == 2 );
3889
+ }
3890
+
3876
3891
// minPos
3877
3892
/**
3878
3893
Computes a subrange of `range` starting at the first occurrence of `range`'s
Original file line number Diff line number Diff line change @@ -3125,7 +3125,10 @@ private:
3125
3125
}
3126
3126
3127
3127
// call possible struct destructors
3128
- .destroy ! (No.initialize)(* cast (T* ) &this .data);
3128
+ static if (is (T == struct ))
3129
+ {
3130
+ .destroy ! (No.initialize)(* cast (T* ) &this .data);
3131
+ }
3129
3132
}
3130
3133
}
3131
3134
You can’t perform that action at this time.
0 commit comments