[Issue 10315] New: Conditional triple operator unifies a char and a dchar as a unit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 9 07:03:24 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10315

           Summary: Conditional triple operator unifies a char and a dchar
                    as a unit
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-09 07:03:23 PDT ---
void main() {
    dchar c;
    pragma(msg, typeof(true ? c : ' '));
}



DMD 2.064alpha prints:
uint

Expected:
dchar


That bad type unification causes situations like:

import std.stdio: writeln;
import std.algorithm: map;
void main() {
    "just 1256 some text"
    .map!(c => true ? c : ' ')
    .writeln;
}


That prints:

[106, 117, 115, 116, 32, 49, 50, 53, 54, 32, 115, 111, 109, 101, 32, 116, 101,
120, 116]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list