https://issues.dlang.org/show_bug.cgi?id=12905
Issue ID: 12905
Summary: [AA] `opCmp` in any struct allow other struct usage in
associative array
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid
Severity: major
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
This code compiles but shouldn't:
---
struct T { int opCmp(); }
struct S {}
int[S] aa; // Compiles iff `T` with `opCmp` exists
---
Currently the compiler tries to enforce `opCmp` existence on AA keys so this is
accepts-invalid bug. Also there is Issue 12255 complaining about `opCmp`
requirement, but anyway this code must either compile or not without depending
on `T` existence.
IMO, this bug causes huge confusion in AAs and should be fixed ASAP.
--