Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dlang#4545 from 9rnsr/fix14207
[REG2.065] Issue 14207 - [CTFE] ICE on unsupported reinterpret cast in compile time Conflicts: src/interpret.c Signed-off-by: Martin Krejcirik <mk@krej.cz>
- Loading branch information
1 parent
c786c8a
commit 176ea43
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/ctfe14207.d(13): Error: cannot convert &immutable(ulong) to ubyte[8]* at compile time | ||
fail_compilation/ctfe14207.d(18): called from here: nativeToBigEndian() | ||
fail_compilation/ctfe14207.d(22): called from here: digest() | ||
--- | ||
*/ | ||
|
||
ubyte[8] nativeToBigEndian() | ||
{ | ||
immutable ulong res = 1; | ||
return *cast(ubyte[8]*) &res; | ||
} | ||
|
||
auto digest() | ||
{ | ||
ubyte[8] bits = nativeToBigEndian(); | ||
return bits; | ||
} | ||
|
||
enum h = digest(); |