opEquals the template?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Oct 1 18:39:29 PDT 2011
Is opEquals not allowed to be a template in a struct? Because I was
using it in my library, and it sort-of worked, up until it started
causing some really weird bugs where a ctor was called instead of
opCast. This results in an error code returned by the compiler:
struct Foo
{
bool opEquals(T)(ref const T rhs) const
{
return this == this;
}
}
void main()
{
auto foo = Foo();
assert(foo == foo);
}
Exit code: -1073741819
And yet it worked fine in a larger module until I've hit the random
buggy behavior.. I don't understand..
More information about the Digitalmars-d
mailing list