www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20030] New: Variant concat of char and string doesn't work

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

          Issue ID: 20030
           Summary: Variant concat of char and string doesn't work
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

The following code throws a VariantException complaining about different types
(char and immutable(char)[]):

unittest {
    import std.variant;
    Variant v = "";
    v ~= 'a';
}

It's correct in some ways, but clearly a more useful behavior would be to
concat the string and char and move on.

--
Jul 05 2019