www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3893] New: opOpAssign and opIndexOpAssign get wrong operator string

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3893

           Summary: opOpAssign and opIndexOpAssign get wrong operator
                    string
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bugzilla kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-03-08
01:52:06 PST ---
The specification says:

    The expression: a op= b
    is rewritten as: a.opOpAssign!("op")(b)

A similar statement is made about opIndexOpAssign. However, what actually
happens is that the template parameter is set to "op=", as this program shows:

    struct S
    {
        void opIndexOpAssign(string op)(int x, int i)
        {
            pragma (msg, op);
        }

        void opOpAssign(string op)(int x)
        {
            pragma(msg, op);
        }
    }

    void main()
    {
        S s;
        s[1] += 2;
        s += 3;
    }

This prints the following on compilation:

  +=
  +=

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3893



--- Comment #1 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-03-25
07:59:53 PDT ---
The documentation has been fixed for opOpAssign, but not for opIndexOpAssign or
opSliceOpAssign.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 25 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3893


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
           Severity|critical                    |normal


--- Comment #2 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-03-25
08:01:43 PDT ---
Downgrading importance since, apparently, the spec is wrong and not the
compiler.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 25 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3893


Lars T. Kyllingstad <bugzilla kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #3 from Lars T. Kyllingstad <bugzilla kyllingen.net> 2010-08-16
04:46:16 PDT ---
The spec was right all along, and the compiler was fixed with DMD 2.047.

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