Bug 20477 – incorrect error: cannot implicitly convert expression of type int to dchar

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-01-03T16:52:39Z
Last change time
2024-12-13T19:06:40Z
Assigned to
No Owner
Creator
Dennis
Moved to GitHub: dmd#19654 →

Comments

Comment #0 by dkorpel — 2020-01-03T16:52:39Z
``` 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
Comment #1 by dominikus — 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.
Comment #2 by robert.schadek — 2024-12-13T19:06:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19654 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB