www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21639] New: Inconsistent output for enum value when calling

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

          Issue ID: 21639
           Summary: Inconsistent output for enum value when calling "text"
                    vs "to!string"
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: apz28 hotmail.com

import std.stdio;
import std.conv : text, to;

enum I : int
{
    x10 = 10,
}

enum C : char
{
    xChar = '%',
}

enum S : string
{
    xString = "a string",
}

void main()
{
    writeln(to!string(I.x10)); // x10
    writeln(to!string(C.xChar)); // xChar
    writeln(to!string(S.xString)); // xString
    writeln(text(I.x10, " ", C.xChar, " ", S.xString)); // x10 % xString
}

--
Feb 15