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: nob...@puremagic.com
        ReportedBy: simen.kja...@gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kja...@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: -------

Reply via email to