digitalmars.D.bugs - [Issue 4853] New: Problems with some dchar/dstring concats
- d-bugmail puremagic.com (39/39) Sep 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4853
- d-bugmail puremagic.com (7/7) Sep 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4853
- d-bugmail puremagic.com (12/12) Sep 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4853
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: sean invisibleduck.org ReportedBy: bearophile_hugs eml.cc (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: -------
Sep 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4853 Probably 'a' ~ 'b' is not allowed in D to keep (in)compatibility with C language, because it has a different meaning in C. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4853 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID Given that, and given that appending a dchar to a string is allowed, but appending a dstring to a string is not allowed, there are no bugs here. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 11 2010