www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18346] New: implicit conversion from int to char in `"foo" ~


          Issue ID: 18346
           Summary: implicit conversion from int to char in `"foo" ~ 255`
                    should be illegal
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

string a="foo" ~ 255; // compiles but should not (too easy to confuse with
"foo"~"255" as in other languages, when instead it means append char(255))

string a="foo" ~ 256;
Error: incompatible types for (("foo") ~ (256)): 'string' and 'int'

instead: we should write:
string a="foo" ~ char(255);

Jan 31 2018