[Issue 19774] wrong code caused by generic variadic opIndex

2019-04-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19774

ag0aep6g  changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #1 from ag0aep6g  ---
Slighlty more reduced:


C bar()
{
return C(42);
}

C foo()
{
return bar()[1];
}

struct C
{
int x;

~this()
{
x = 0;
}

C opIndex(int a)
{
return this;
}
}

void main()
{
auto c = foo();
assert(c.x == 42); /* fails; should pass */
}


--


[Issue 19774] wrong code caused by generic variadic opIndex

2019-03-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19774

Илья Ярошенко  changed:

   What|Removed |Added

   Keywords||wrong-code

--