Thread overview
[Issue 4993] New: Temporary values and opIndexAssign
Oct 04, 2010
Simen Kjaeraas
Mar 07, 2012
Nils
Mar 07, 2012
Nils
Mar 07, 2012
Nils
Mar 18, 2012
Walter Bright
October 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4993

           Summary: Temporary values and opIndexAssign
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: simen.kjaras@gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras@gmail.com> 2010-10-04 13:14:44 PDT ---
The following code does not compile. Note that the exact same functions are present in both the inner and outer structs, and that opIndex works for both.

struct Foo{
    struct Bar {
        int opIndex( size_t index ) {
            return 3;
        }

        void opIndexAssign( int value, size_t index ) {
        }
    }
    @property
    auto bar( ) {
        return Bar( );
    }

    int opIndex( size_t index ) {
        return 3;
    }

    void opIndexAssign( int value, size_t index ) {
    }
}

void main( ) {
    Foo f;
    f[3] = f[2];
    Foo.Bar b;
    b[3] = b[2];
    f.bar[3] = f.bar[2]; // Fails
}


foo.d(28): Error: f.bar()[3u] is not an lvalue

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4993


Nils <mailme+d@nilsb.dyndns.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha@yahoo.com


--- Comment #2 from Nils <mailme+d@nilsb.dyndns.org> 2012-03-06 23:34:22 PST ---
*** Issue 5202 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4993


Nils <mailme+d@nilsb.dyndns.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |mailme+d@nilsb.dyndns.org


--- Comment #3 from Nils <mailme+d@nilsb.dyndns.org> 2012-03-06 23:38:59 PST ---
https://github.com/D-Programming-Language/dmd/pull/791

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4993



--- Comment #4 from Nils <mailme+d@nilsb.dyndns.org> 2012-03-07 03:01:36 PST ---
(In reply to comment #3)
> https://github.com/D-Programming-Language/dmd/pull/791

That one has been superseded by https://github.com/D-Programming-Language/dmd/pull/763

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4993


Walter Bright <bugzilla@digitalmars.com> changed:

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


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