Comment #0 by bearophile_hugs — 2010-06-06T12:30:50Z
The syntax of this D2 code seems correct (removing the const this code used to work in D1):
struct Foo(size_t N) {
bool opEquals(ref const(Foo!(N))) const {
return false;
}
}
alias Foo!(2) Foo2;
void main() {}
But DMD v2.046 prints at compile-time:
test.d(2): Error: function test.Foo!(2).Foo.opEquals type signature should be const bool(ref const(Foo!(2))) not const bool(ref const(Foo!(N)))
test.d(6): Error: template instance test.Foo!(2) error instantiating
Comment #1 by clugdbug — 2010-09-22T03:40:56Z
*** This issue has been marked as a duplicate of issue 3607 ***
Comment #2 by clugdbug — 2010-12-01T02:29:17Z
Turns out this is completely unrelated to bug 3607. And it actually has nothing to do with opEquals, either!
Change the test case from this:
alias Foo!(2) Foo2;
to this:
alias Foo!(2u) Foo2;
and it compiles!!!
This is the same issue as bug 2257.
*** This issue has been marked as a duplicate of issue 2257 ***