www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14998] New: Cannot put a char into a char[]

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

          Issue ID: 14998
           Summary: Cannot put a char into a char[]
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: schneider.cedric gmx.de

Following code does not compile:

int main()
{
     import std.stdio;
     import std.range;
     char[] c;
     c ~= 'a';
     c ~= 'b';
     c.put('c');
     writeln(c);
     return 0;
}

The error is:

C:\dmd\src\phobos\std\range.d(9,9): Error: static assert  "Cannot put a
char into a char[]." (Test)

--
Sep 01 2015