On Wednesday, 16 May 2018 at 10:51:51 UTC, jmh530 wrote:
On Wednesday, 16 May 2018 at 09:01:29 UTC, Simen Kjærås wrote:
snip]
struct Foo(int x)
{
int n = x;
auto opDispatch(string s)()
if (s == "bar")
{
n++;
return n;
}
}
unittest
{
int y = 0;
with(Foo!1())
{
y = bar; // Works!
}
assert(y == 2);
}
--
Simen
Thanks for catching that. Any idea why the original was having
problems?
Seems to me there's an issue with overload priority - we expect
opDispatch to count before globals, but it doesn't. Filed an
issue: https://issues.dlang.org/show_bug.cgi?id=18866
--
Simen