Thread overview
[Issue 4099] New: Inconsistent behaviour of ++/-- when mixing opUnary and 'alias this'.
Aug 16, 2011
Kenji Hara
Aug 25, 2011
Walter Bright
April 17, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4099

           Summary: Inconsistent behaviour of ++/-- when mixing opUnary
                    and 'alias this'.
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: a3471210@owlpic.com


--- Comment #0 from a3471210@owlpic.com 2010-04-17 05:13:08 PDT ---
In the following example, ++x calls opUnary while x++ is performed on x directly:

struct X
{
    int x;
    alias x this;

    typeof(this) opUnary (string operator) ()
    {
        writeln ("operator called");
        return this;
    }
}
unittest
{
    X x;
    ++x; //operator called
    auto y = x++; //BUG! (alias this used. returns int)
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4099


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid
                 CC|                            |k.hara.pg@gmail.com


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-08-15 20:38:36 PDT ---
https://github.com/D-Programming-Language/dmd/pull/314

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4099


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-08-25 00:23:10 PDT ---
https://github.com/D-Programming-Language/dmd/commit/09998d8759d698ec25f9895734e64734a7f78a30

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