[Issue 8328] Wrong constness of autogenerated opEquals when fields' opEquals have mixed constness

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 14 06:54:42 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=8328

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |DUPLICATE

--- Comment #8 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Vladimir Panteleev from comment #4)
> Minimal testcase:
> ---
> struct S1 { bool opEquals(S1 o)       { return true; } }
> struct S2 { bool opEquals(S2 o) const { return true; } }
> struct X { S1 s1; S2 s2; }
> ---
> 
> The problem seems to be that DMD decides that the autogenerated opEquals
> should be "const", and then fails when it tries to call S1's opEquals.

>From 2.063, compiler never generate opEquals for structs comparison.
https://github.com/D-Programming-Language/dmd/pull/1972

*** This issue has been marked as a duplicate of issue 3789 ***

--


More information about the Digitalmars-d-bugs mailing list