[Issue 12711] New: Ternary operator turns a character into an integral
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue May 6 12:22:40 PDT 2014
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: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
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.
--
More information about the Digitalmars-d-bugs
mailing list