From fd43568cc54e17c8b4a845677872c6282bc6dbb7 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Wed, 15 Dec 2021 19:47:02 +0100 Subject: d: Merge upstream dmd 93108bb9e, druntime 6364e010, phobos 575b67a9b. D front-end changes: - Import dmd v2.098.1-beta.1. - Default extern(C++) compatibility to C++17. Druntime changes: - Import druntime v2.098.1-beta.1. - Fix definition of stat_t on MIPS64 (PR103604) Phobos changes: - Import phobos v2.098.1-beta.1. gcc/d/ChangeLog: * d-lang.cc (d_init_options): Set default -fextern-std= to C++17. * dmd/MERGE: Merge upstream dmd 93108bb9e. * gdc.texi (Runtime Options): Document the default for -fextern-std=. libphobos/ChangeLog: PR d/103604 * configure: Regenerate. * configure.ac (libtool_VERSION): Update to 3:0:0. * libdruntime/MERGE: Merge upstream druntime 6364e010. * src/MERGE: Merge upstream phobos 575b67a9b. * testsuite/libphobos.traits/all_satisfy.d: New test. * testsuite/libphobos.traits/traits.exp: New test. --- libphobos/src/std/algorithm/searching.d | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libphobos/src/std/algorithm') diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d index 96352064c55..55a14385e8a 100644 --- a/libphobos/src/std/algorithm/searching.d +++ b/libphobos/src/std/algorithm/searching.d @@ -638,7 +638,7 @@ Returns: */ size_t count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && - is(typeof(binaryFun!pred(haystack.front, needle)) : bool)) + is(typeof(binaryFun!pred(haystack.front, needle)))) { bool pred2(ElementType!Range a) { return binaryFun!pred(a, needle); } return count!pred2(haystack); @@ -693,7 +693,7 @@ if (isInputRange!Range && !isInfinite!Range && size_t count(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && !isInfinite!R1 && isForwardRange!R2 && - is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) + is(typeof(binaryFun!pred(haystack.front, needle.front)))) { assert(!needle.empty, "Cannot count occurrences of an empty range"); @@ -716,7 +716,7 @@ if (isForwardRange!R1 && !isInfinite!R1 && /// Ditto size_t count(alias pred, R)(R haystack) if (isInputRange!R && !isInfinite!R && - is(typeof(unaryFun!pred(haystack.front)) : bool)) + is(typeof(unaryFun!pred(haystack.front)))) { size_t result; alias T = ElementType!R; //For narrow strings forces dchar iteration @@ -745,6 +745,12 @@ if (isInputRange!R && !isInfinite!R) assert([1, 2, 3].count([2, 3]) == 1); } +// https://issues.dlang.org/show_bug.cgi?id=22582 +@safe unittest +{ + assert([1, 2, 3].count!"a & 1" == 2); +} + /++ Counts elements in the given $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) -- cgit v1.2.3