Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect error: cannot implicitly convert expression of type int to dchar #19654

Open
dlangBugzillaToGithub opened this issue Jan 3, 2020 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

Dennis (@dkorpel) reported this on 2020-01-03T16:52:39Z

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

CC List

  • Dominikus Dittes Scherkl

Description

```
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
@dlangBugzillaToGithub
Copy link
Author

dominikus commented on 2020-01-04T15:40:15Z

dchar is designed to contain unicode values, which are limited to the range 0x00000000 to 0x0010FFFF == 1114111, so the given literal is outside this range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant