Bug 13793 – @nogc std.algorithm.count(std.range.only)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-11-29T13:19:58Z
Last change time
2018-02-10T19:49:38Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-11-29T13:19:58Z
I think this doesn't need to allocate heap memory: void main() @nogc { import std.algorithm: count; import std.range: only; int[] a; auto r = a.count(only(0, 1)); } dmd 2.067alpha: test.d(5,21): Error: @nogc function 'D main' cannot call non-@nogc function 'std.algorithm.count!("a == b", int[], OnlyResult!(int, 1u)).count'
Comment #1 by greensunny12 — 2018-02-10T19:49:38Z
Works in 2.078, It has been fixed in 2.069 https://run.dlang.io/is/RC554K