www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4099] New: Inconsistent behaviour of ++/-- when mixing opUnary and 'alias this'.

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



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: -------
Apr 17 2010
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Aug 15 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Aug 25 2011