Summary: Possible bug in compiler or documentation regarding
                    signature of opCmp()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-11-14 13:07:07 PST ---
The documentation writes that "For
the .sort property to work on arrays of structs or unions, the struct or union
definition must define the function: int opCmp(S) or int opCmp(S*)". That is
misleading, as, in my experience, a struct must implement exactly "int
opCmp(ref const S) const" in order to get .sort work. Signatures which are a
bit different do not work.

The documentation should be updated as soon as possible, either informing the
programmer about a current bug in the compiler, or clearly stating that only
this signature works! In addition, I think that the compiler should warn about
using a likely incorrect signature.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to