Bug 14764 – std.range.only errors on enum members

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-07-02T17:38:00Z
Last change time
2015-07-21T12:53:49Z
Assigned to
nobody
Creator
initrd.gz

Comments

Comment #0 by initrd.gz — 2015-07-02T17:38:57Z
Attempting to use `std.range.only` with enum members throws a compile error. Example Program: import std.stdio; import std.range; enum TestEnum { A = 501, B = 502 } void main() { auto f = only(TestEnum.A, TestEnum.B); } Output: $ rdmd ~/test.d /usr/include/dmd/phobos/std/range/package.d(6058): Error: cannot implicitly convert expression (0) of type int to TestEnum[2] /home/col/test.d(11): Error: template instance std.range.only!(TestEnum, TestEnum) error instantiating Failed: ["dmd", "-v", "-o-", "/home/col/test.d", "-I/home/col"]
Comment #1 by dsp — 2015-07-07T04:45:56Z
I can't reproduce this with dmd/druntime/phobos v2.068-devel
Comment #2 by japplegame — 2015-07-21T10:15:11Z
Looks like regression in dmd 2.067.1 2.066.1 - http://goo.gl/acYpml (success) 2.067.1 - http://goo.gl/hp8CTo (fail) nightly build - http://goo.gl/yoZZGE (fail)
Comment #3 by code — 2015-07-21T12:53:49Z
The fix is included in 2.068.0-b1 (http://downloads.dlang.org/pre-releases/2.x/2.068.0/). *** This issue has been marked as a duplicate of issue 14556 ***