[Issue 18346] New: implicit conversion from int to char in `"foo" ~ 255` should be illegal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 1 06:11:46 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18346

          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 at puremagic.com
          Reporter: timothee.cour2 at 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);
```

--


More information about the Digitalmars-d-bugs mailing list