Problem found on tuples by Magnus Lie Hetland, then reduced: import std.typecons; void main() { alias Tuple!int T; const T t; bool b = t == t; } DMD 2.052 shows: test.d(5): Error: template std.typecons.Tuple!(int).Tuple.opEquals(R) if (isTuple!(R)) does not match any function template declaration test.d(5): Error: template std.typecons.Tuple!(int).Tuple.opEquals(R) if (isTuple!(R)) cannot deduce template function from argument types !()(const(Tuple!(int))) I think it can be further reduced to: struct Foo(T) { bool opEquals(R)(R rhs) { return false; } } void main() { const Foo!int f; bool result = f == f; }
opEquals is a non-const method (issue 1824). Of course a const object cannot call it. The reduced test case is working as expected. The problem is just Tuple needs a const opEquals.
(In reply to comment #1) > opEquals is a non-const method (issue 1824). Of course a const object cannot > call it. The reduced test case is working as expected. The problem is just > Tuple needs a const opEquals. Thank you for your answer. A secondary problem here is that I wasn't unable to understand what the problem was from those error messages. So is it possible to improve them?
*** Issue 7586 has been marked as a duplicate of this issue. ***
Seems to be fixed in 2.061.