onlineapp.d(22): Error: CTFE internal error: bad compare of `["tt":Helper("hello world")]` and `null` Illegal instruction (core dumped)
image/png
12382
Comments
Comment #0 by msnmancini — 2021-12-27T16:33:06Z
Created attachment 1836
onlineapp.d(22): Error: CTFE internal error: bad compare of `["tt":Helper("hello world")]` and `null` Illegal instruction (core dumped)
Attached the image proving the crash
The error message I got was CTFE internal error: bad compare of `["hipengine_api":Dependency("../../api")]` and `null`
It is an associative array of string:struct.
```d
import std;
struct Helper
{
string hello;
}
struct OurComposition
{
string compositionName;
Helper[string] helpers;
}
enum OurComposition test =
{
compositionName : "Tester",
helpers : [
"tt" : Helper("hello world")
]
};
enum hasHelper = test.helpers != null;
void main()
{
writeln("Hello D. ", hasHelper);
}
```
I believe this is a real corner case, it didn't happen until I used a struct initialization syntax
@wolframw created dlang/dmd pull request #13465 "Fix issue 22632 - Crash happens when CTFE compares an associative arr…" fixing this issue:
- Fix issue 22632 - Crash happens when CTFE compares an associative array to null using ==
https://github.com/dlang/dmd/pull/13465
Comment #3 by dlang-bot — 2022-01-01T00:05:58Z
dlang/dmd pull request #13465 "Fix issue 22632 - Crash happens when CTFE compares an associative arr…" was merged into master:
- c238e37f54a937c416a586330e551306a7c74a2d by wolframw:
Fix issue 22632 - Crash happens when CTFE compares an associative array to null using ==
https://github.com/dlang/dmd/pull/13465