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

           Summary: Problems with some dchar/dstring concats
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: s...@invisibleduck.org
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-09-11 08:41:59 PDT ---
(Partially found by Andrej Mitrovic)
This D2 program shows something strange:


void main() {
    string s;
    char c;
    dchar d;
    dstring ds;
    s ~= d;            // OK
    s ~= c ~ c;        // ERR
    s ~= "" ~ c ~ c;   // OK
    s ~= ""d ~ d ~ d;  // ERR
    ds ~= d ~ d;       // ERR
    ds ~= ""d ~ d ~ d; // OK
}


DMD 2.048 shows:
test.d(7): Error: incompatible types for ((cast(int)c) ~ (cast(int)c)): 'int'
and 'int'
test.d(9): Error: cannot append type immutable(dchar)[] to type string
test.d(10): Error: incompatible types for ((cast(uint)d) ~ (cast(uint)d)):
'uint' and 'uint'


What's the right way to append two dchar to a string?


I think even this line of code may eventually become correct:
string cc = 'a' ~ 'b';

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

Reply via email to