www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20477] New: incorrect error: cannot implicitly convert

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 puremagic.com
          Reporter: dkorpel 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

--
Jan 03