[Issue 22632] New: Crash happens when CTFE compares a struct associative array member to null using == when initialization syntax used
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 27 16:33:06 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22632
Issue ID: 22632
Summary: Crash happens when CTFE compares a struct associative
array member to null using == when initialization
syntax used
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: msnmancini at hotmail.com
Created attachment 1836
--> https://issues.dlang.org/attachment.cgi?id=1836&action=edit
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
--
More information about the Digitalmars-d-bugs
mailing list