[Issue 15582] Slice returned by opSlice() not accepted as lvalue
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 18 14:16:00 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15582
b2.temp at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
--- Comment #1 from b2.temp at gmx.com ---
(In reply to Marc Schütz from comment #0)
> I believe this should work:
>
> struct S {
> int[10] data;
> auto opSlice() { return data[]; }
> }
>
> void main() {
> S s;
> s[] = 10; // Error: s[] is not an lvalue
> s[][] = 10; // works
> }
I don't aggree, it's like if you say that
s.opSlice() = 10;
should work.
--
More information about the Digitalmars-d-bugs
mailing list