www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14764] New: std.range.only errors on enum members


          Issue ID: 14764
           Summary: std.range.only errors on enum members
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: initrd.gz gmail.com

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);


$ 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"]

Jul 02 2015