[Issue 20477] New: incorrect error: cannot implicitly convert expression of type int to dchar

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 3 16:52:39 UTC 2020


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

          Issue ID: 20477
           Summary: incorrect error: cannot implicitly convert expression
                    of type int to dchar
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

```
void main() {
    static assert(is(int:dchar));
    int a = 1114112;
    dchar b = a;
    dchar c = 1114112;
}
```

On variable c it says Error: cannot implicitly convert expression 1114112 of
type int to dchar. The value is above `dchar.max`, but since `is(int:dchar)`
the error "cannot implicitly convert" is false.

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

--


More information about the Digitalmars-d-bugs mailing list