http://d.puremagic.com/issues/show_bug.cgi?id=3789
Summary: comparing a struct with an array member does a bitwise compare Product: D Version: 2.040 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: schvei...@yahoo.com --- Comment #0 from Steven Schveighoffer <schvei...@yahoo.com> 2010-02-09 12:08:23 PST --- If you have a struct that does not define opEquals, but which contains a member that defines opEquals, that member's opEquals is called when comparing the struct. However, arrays are still bitwise compared. Example: struct String { char[] data; } void main () { auto foo = String("foo".dup); auto bar = String("foo".dup); assert(bar.data == foo.data); assert(bar == foo, "oops structs aren't equal"); } results in the second assert failing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------