[Issue 3433] [tdpl] Comparing structs for equality is not member-by-member

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 13 23:52:29 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3433


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #5 from Don <clugdbug at yahoo.com.au> 2009-11-13 23:52:28 PST ---
This has some tricky points. The first is that it's recursive. As well as
structs, it also applies to fixed-length arrays: if either contains a struct
with an opEquals, the entire struct must be compared member-by-member; and this
check must be performed recursively.
Secondly, what happens with unions?

struct Rectangle {
   union {
      Point leftBottom;
      int problematic;
   }
}
I think this should probably be an error.
The third difficult part relates to protection. Any of the struct members may
be private and defined in a different module.

If a field in the struct is a class, it probably applies to it as well.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list