Vladimir Panteleev <> changed:

           What    |Removed                     |Added
           Keywords|                            |rejects-valid
                 CC|                            |
           Platform|x86_64                      |All
            Summary|Mind Blowing error          |Wrong constness of
                   |(possibly in DMD or         |autogenerated opEquals when
                   |std.variant)                |fields' opEquals have mixed
                   |                            |constness
         OS/Version|Linux                       |All
           Severity|critical                    |normal

--- Comment #4 from Vladimir Panteleev <> 2012-06-30 
18:07:42 PDT ---
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.

The solution for this particular problem would be to reverse the
common-denominator logic, although this won't work if immutable is thrown into
the mix. A better error message would also be an improvement.

Write your own non-const opEquals in X.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to