May 11, 2011 [Issue 5979] New: bigint rvalue equality | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5979 Summary: bigint rvalue equality Product: D Version: D2 Platform: All OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: dpx.infinity@gmail.com --- Comment #0 from Vladimir Matveev <dpx.infinity@gmail.com> 2011-05-11 09:46:20 PDT --- Code import std.bigint; BigInt foo() { return BigInt(128); } void main() { BigInt bar = BigInt(128); assert(foo() == bar); assert(bar == foo()); // *** HERE } does not compile with the following error on the marked line: test.d(10): Error: foo() is not an lvalue It seems that is because of the ref parameter of the opEquals method in the BigInt structure. Obviously it is not needed for the parameter to be a reference in this case, though it could be thought as a possible performance tweak (I don't know for certain about the correctnes of this though). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 11, 2011 [Issue 5979] bigint equality comparison with rvalue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Matveev | http://d.puremagic.com/issues/show_bug.cgi?id=5979 kennytm@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |kennytm@gmail.com Resolution| |DUPLICATE --- Comment #1 from kennytm@gmail.com 2011-05-11 10:40:22 PDT --- Unfortunately an opEquals for a struct must take the signature of (ref const S s). See http://d-programming-language.org/operatoroverloading.html#equals. The rvalue problem here is a specialization of bug 5609. Allowing struct to have any signature is a duplicate of issue 3659. *** This issue has been marked as a duplicate of issue 5609 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation