[Issue 6948] New: Possible bug in compiler or documentation regarding signature of opCmp()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 14 13:07:53 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6948
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
AssignedTo: nobody at puremagic.com
ReportedBy: kukac at mailinator.com
--- Comment #0 from kukac at mailinator.com 2011-11-14 13:07:07 PST ---
The documentation http://www.digitalmars.com/d/2.0/arrays.html 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list