[Issue 10064] opDollar called on garbage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 13 04:28:04 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10064
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|opDollar+final interface |opDollar called on garbage
|function results in a wrong |
|code |
--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-06-13 15:28:03 MSD ---
I was incorrect about the issue source. `opDollar` is just called on a garbage:
---
struct S
{
int x = 3;
@disable this();
this(int)
{ x = 7; }
int opSlice(size_t, size_t)
{ return 0; }
@property size_t opDollar()
{
assert(x == 7 || x == 3); // fails
assert(x == 7);
return 0;
}
}
void main()
{
auto x = S(0)[0 .. $];
}
---
As a result e.g. this will fail too:
---
import std.range;
void main()
{
auto x = zip([1])[$ - 1];
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list