[Issue 21109] Possibly wrong codegen when using enum arrays
https://issues.dlang.org/show_bug.cgi?id=21109 --- Comment #4 from Andrej Mitrovic --- (In reply to Andrej Mitrovic from comment #3) > I think this is related to `sort`. It's possible that sort compares by > pointers if two structs are otherwise equivalent. > > And then using `enum` has a different effect on arrays, possibly optimizing > and storing the same pointer in two structs (making them equal). Sorry the actual reasoning should be: `enum` always allocates a new array, therefore the pointer addresses change each time. It's possible opCmp does a value comparison first, and then a pointer comparison. But I don't think pointers should be compared at all.. at least not when dealing with arrays and not naked pointers in a struct. --
[Issue 21109] Possibly wrong codegen when using enum arrays
https://issues.dlang.org/show_bug.cgi?id=21109 --- Comment #3 from Andrej Mitrovic --- I think this is related to `sort`. It's possible that sort compares by pointers if two structs are otherwise equivalent. And then using `enum` has a different effect on arrays, possibly optimizing and storing the same pointer in two structs (making them equal). --
[Issue 21109] Possibly wrong codegen when using enum arrays
https://issues.dlang.org/show_bug.cgi?id=21109 --- Comment #2 from Andrej Mitrovic --- I've confirmed the issue with ldc2 as well. So it looks like it's a front-end bug. --
[Issue 21109] Possibly wrong codegen when using enum arrays
https://issues.dlang.org/show_bug.cgi?id=21109 --- Comment #1 from Andrej Mitrovic --- Using DMD v2.093.0. --