aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/algorithm
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-15 19:47:02 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-15 19:51:30 +0100
commitfd43568cc54e17c8b4a845677872c6282bc6dbb7 (patch)
tree24f591392a2978706aef4d58e377b8b42b5ba418 /libphobos/src/std/algorithm
parent639ece7abfa3688008cb791aec4c7a1a4f76e59f (diff)
downloadgcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.zip
gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.gz
gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.bz2
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.
Diffstat (limited to 'libphobos/src/std/algorithm')
-rw-r--r--libphobos/src/std/algorithm/searching.d12
1 files changed, 9 insertions, 3 deletions
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index 9635206..55a1438 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)