----- 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.
(In reply to Andrej Mitrovic from comment #0) > This is very ugly. I'm not sure whether it's a DMD bug or a Phobos bug > though. It's an ugly dmd bug: void main() { pragma(msg, typeof(true ? char('x') : '_')); pragma(msg, typeof(true ? wchar('x') : '_')); pragma(msg, typeof(true ? dchar('x') : '_')); } Output: char int uint But perhaps I already reported this issue, please search it in Bugzilla.
Seems like a dupe or another case of https://issues.dlang.org/show_bug.cgi?id=11732
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18825 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB