summaryrefslogtreecommitdiff
path: root/libphobos/src
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-20 19:25:32 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-20 19:29:43 +0100
commitb3f58f87d78b958e35e4a44f5fdb4b7721cb2837 (patch)
treecb6530272537c7d845faab6a1ce0042f3096f618 /libphobos/src
parent7d5d5032c7200714388db63c7a5676b6ab3e040e (diff)
downloadgcc-b3f58f87d78b958e35e4a44f5fdb4b7721cb2837.tar.gz
d: Merge upstream dmd ad8412530, druntime fd9a4544, phobos 495e835c2.
D front-end changes: - Import dmd v2.098.1 - Remove calling of _d_delstruct from code generator. Druntime changes: - Import druntime v2.098.1 Phobos changes: - Import phobos v2.098.1 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ad8412530. * expr.cc (ExprVisitor::visit (DeleteExp *)): Remove code generation of _d_delstruct. * runtime.def (DELSTRUCT): Remove. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime fd9a4544. * src/MERGE: Merge upstream phobos 495e835c2.
Diffstat (limited to 'libphobos/src')
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/format/write.d23
-rw-r--r--libphobos/src/std/range/interfaces.d9
-rw-r--r--libphobos/src/std/typecons.d2
4 files changed, 34 insertions, 2 deletions
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index c9d166b03a7..b517749b542 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-575b67a9b4f78415f96ca77ad50b2de4c667cc74
+495e835c2da47606142ff24c85de707e3b955a9a
The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/format/write.d b/libphobos/src/std/format/write.d
index c7587688fc0..e67d95ccc23 100644
--- a/libphobos/src/std/format/write.d
+++ b/libphobos/src/std/format/write.d
@@ -1287,3 +1287,26 @@ void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T val, scope const
assertThrown!FormatException(formattedWrite(w, "%(%0*d%)", new int[1]));
}
+
+// https://issues.dlang.org/show_bug.cgi?id=22609
+@safe pure unittest
+{
+ static enum State: ubyte { INACTIVE }
+ static struct S {
+ State state = State.INACTIVE;
+ int generation = 1;
+ alias state this;
+ // DMDBUG: https://issues.dlang.org/show_bug.cgi?id=16657
+ auto opEquals(S other) const { return state == other.state && generation == other.generation; }
+ auto opEquals(State other) const { return state == other; }
+ }
+
+ import std.array : appender;
+ import std.format.spec : singleSpec;
+
+ auto writer = appender!string();
+ const spec = singleSpec("%s");
+ S a;
+ writer.formatValue(a, spec);
+ assert(writer.data == "0");
+}
diff --git a/libphobos/src/std/range/interfaces.d b/libphobos/src/std/range/interfaces.d
index 475f35b51da..6d55d4149c7 100644
--- a/libphobos/src/std/range/interfaces.d
+++ b/libphobos/src/std/range/interfaces.d
@@ -201,6 +201,9 @@ interface RandomAccessFinite(E) : BidirectionalRange!(E) {
/**Interface for an infinite random access range of type `E`.*/
interface RandomAccessInfinite(E) : ForwardRange!E {
+ ///
+ enum bool empty = false;
+
/**Calls $(REF moveAt, std, range, primitives) on the wrapped range, if
* possible. Otherwise, throws an $(LREF UnsupportedRangeMethod) exception.
*/
@@ -213,6 +216,12 @@ interface RandomAccessInfinite(E) : ForwardRange!E {
E opIndex(size_t);
}
+// https://issues.dlang.org/show_bug.cgi?id=22608
+@safe unittest
+{
+ static assert(isRandomAccessRange!(RandomAccessInfinite!int));
+}
+
/**Adds assignable elements to InputRange.*/
interface InputAssignable(E) : InputRange!E {
///
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d
index 6dee863521d..cde2b9da055 100644
--- a/libphobos/src/std/typecons.d
+++ b/libphobos/src/std/typecons.d
@@ -6971,7 +6971,7 @@ mixin template Proxy(alias a)
static if (is(typeof(a.opCmp(b))))
return a.opCmp(b);
else static if (is(typeof(b.opCmp(a))))
- return -b.opCmp(b);
+ return -b.opCmp(a);
else
return a < b ? -1 : a > b ? +1 : 0;
}