www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14042] New: std.conv.to of a immutable char pointer

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

          Issue ID: 14042
           Summary: std.conv.to of a immutable char pointer
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

This seems a regression:

void main() {
    import std.conv: to;
    immutable(char)* ptr = "hello".ptr;
    auto result = ptr.to!(char[]);
}


...\dmd2\src\phobos\std\conv.d(871,16): Error: cannot implicitly convert
expression (value ? dup(value[0..strlen(value)]) : null) of type const(char)[]
to char[]
...\dmd2\src\phobos\std\conv.d(287,24): Error: template instance
std.conv.toImpl!(char[], immutable(char)*) error instantiating
test.d(4,22):        instantiated from here: to!(immutable(char)*)

--
Jan 24 2015