[Issue 19666] Implicit cast from static array to its .ptr not properly rejected during CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 5 13:30:08 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=19666
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
Summary|Compiler executes illegal |Implicit cast from static
|instruction casting array |array to its .ptr not
|to struct pointer |properly rejected during
| |CTFE
--- Comment #3 from Basile-z <b2.temp at gmx.com> ---
my last comment is wrong, the problem is that implicit conv from static array
to its .ptr is not implemented correctly in the CTFE engine.
The expected error happens when doing the cast explicitly:
```d
struct StoreAny {
ubyte[16] store;
this(T)(T value) {
*(cast(T*) store.ptr) = value;
}
}
struct SomeStruct {}
enum StoreAny someEnum = StoreAny(SomeStruct());
```
> a.d:4:20: Error: reinterpreting cast from `ubyte*` to `SomeStruct*` is not supported in CTFE
--
More information about the Digitalmars-d-bugs
mailing list