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

          Issue ID: 12711
           Summary: Ternary operator turns a character into an integral
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: [email protected]
          Reporter: [email protected]

-----
import std.ascii;
import std.algorithm;
import std.stdio;

void main()
{
    writeln( "foo-bar-doo".map!(a => a.isAlphaNum ? a : '_') );
    writeln( "foo-bar-doo".map!(a => a.isAlphaNum ? a : cast(dchar)'_') );
}
-----

$ dmd -run test.d
> [102, 111, 111, 95, 98, 97, 114, 95, 100, 111, 111]
> foo_bar_doo

This is very ugly. I'm not sure whether it's a DMD bug or a Phobos bug though.

--

Reply via email to