digitalmars.D.bugs - [Issue 15812] New: static struct inside extern(C++) class cannot be
- via Digitalmars-d-bugs (40/40) Mar 19 2016 https://issues.dlang.org/show_bug.cgi?id=15812
https://issues.dlang.org/show_bug.cgi?id=15812 Issue ID: 15812 Summary: static struct inside extern(C++) class cannot be used as key to associative array Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Given: extern (C++) class C { struct S { int ti; this(int ti) { this.ti = ti; } size_t toHash() const safe nothrow { return ti; } bool opEquals(ref const S s) trusted const { return s.ti == ti; } } } alias SS = C.S; void main() { int[SS] aa; auto s = SS(3); aa[s] = 4; } fails with: foo10.d(22): Error: AA key type S should have 'size_t toHash() const nothrow safe' if opEquals defined but it works if the extern (C++) is removed. --
Mar 19 2016