Re: struct opEquals does not work with parameter of same type - bug or feature?

2011-08-29 Thread Jonathan M Davis
On Monday, August 29, 2011 22:41:26 Sean Eskapp wrote: I am trying to build a struct with equality testing, using this code: struct Foo { const bool opEquals(Foo f) { return true; } } This gives me the error that the parameter should be of type ref const Foo.

Re: struct opEquals does not work with parameter of same type - bug or feature?

2011-08-29 Thread Sean Eskapp
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article On Monday, August 29, 2011 22:41:26 Sean Eskapp wrote: I am trying to build a struct with equality testing, using this code: struct Foo { const bool opEquals(Foo f) { return true; } } This

Re: struct opEquals

2011-03-09 Thread Steven Schveighoffer
On Wed, 09 Mar 2011 11:40:25 -0500, SiegeLord n...@none.com wrote: 1) Why does this code not work (dmd 2.051) and how do I fix it: struct S { static S New() { S s; return s; } const bool opEquals(ref const(S) s) {

Re: struct opEquals

2011-03-09 Thread SiegeLord
Steven Schveighoffer Wrote: It's a mis-designed feature of structs. There is a bug report on it: http://d.puremagic.com/issues/show_bug.cgi?id=3659 It worked fine in D1. Or did you mean that the mis-designed feature is the const system? Anyway, thanks for the link to the bug report. I'll

Re: struct opEquals

2011-03-09 Thread Steven Schveighoffer
On Wed, 09 Mar 2011 12:15:26 -0500, SiegeLord n...@none.com wrote: Steven Schveighoffer Wrote: It's a mis-designed feature of structs. There is a bug report on it: http://d.puremagic.com/issues/show_bug.cgi?id=3659 It worked fine in D1. Or did you mean that the mis-designed feature is