www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6948] New: Possible bug in compiler or documentation regarding signature of opCmp()

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: kukac mailinator.com



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: -------
Nov 14 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6948


Alex Rønne Petersen <xtzgzorex gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xtzgzorex gmail.com



13:20:44 PST ---
It is by design that only that specific overload works (see The D Programming
Language). The documentation is wrong here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6948


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



01:02:40 PST ---
https://github.com/D-Programming-Language/d-programming-language.org/commit/955530833c2221e934f24dd4f0c431b724e4db58

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