Bug 22546 – bad diagnostic for CTFE array cast of string in UDA

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-25T17:16:09Z
Last change time
2024-12-13T19:19:26Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Dennis
Moved to GitHub: dmd#20012 →

Comments

Comment #0 by dkorpel — 2021-11-25T17:16:09Z
I was messing around with weird combinations of string literals and found this oddity: ``` enum a = cast(dstring) "what"c; @(cast(dstring) "huh"c) int x; ``` The first line gives: Error: array cast from `string` to `dstring` is not supported at compile time Makes sense, but the second line: /dlang/dmd/linux/bin64/../../src/druntime/import/core/memory.d(1023): Error: `fakePureErrno` cannot be interpreted at compile time, because it has no available source code When adding one more character to the string, it gets a bit more sensible again: /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/array/casting.d(90): Error: reinterpreting cast from `string` to `Array*` is not supported in CTFE onlineapp.d(2): called from here: `__ArrayCast("huha"c)` Not encountered in any actual code, so filing as a minor issue.
Comment #1 by robert.schadek — 2024-12-13T19:19:26Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20012 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB