[Issue 12905] New: [AA] `opCmp` in any struct allow other struct usage in associative array
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 13 00:53:08 PDT 2014
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: nobody at puremagic.com
Reporter: verylonglogin.reg at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list