www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16135] New: missing std.format import in

https://issues.dlang.org/show_bug.cgi?id=16135

          Issue ID: 16135
           Summary: missing std.format import in std.algorithm.comparison
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schuetzm gmx.net

import std.algorithm : castSwitch;

interface I { }
class B : I { }

void main() {
    Object[] arr = [new B(), null];
    castSwitch!(
        (I i) => "derived from I",
        (B b) => "class B",
    );
}

Results in:
/home/marc/d/phobos/std/algorithm/comparison.d(275): Error: no property
'format' for type 'string'

Apparently, an import is missing there.

Discovered by user on the forum:
https://forum.dlang.org/post/nokrqjmmmzeqygtaxvox forum.dlang.org

--
Jun 07 2016