[Issue 14781] impure delegate to pure function context should be able to modify context

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 8 11:22:05 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14781

--- Comment #4 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Denis Shelomovskij from comment #3)

> Do you mean this code should compile?

Yes.

> If so, either pure function `bar` can
> call an impure function or impure delegate is implicitly convertible to a
> pure one.

No, but I made an error in the example from what I meant.

should be:

auto foo(out int delegate() impureDg) pure {

...

impureDg = &(bar!());

> If you are opening an issue with an enhancement please provide a clear and
> concise testcase. Thanks.

It's hard to make a test case that "should compile" without making an error
with no compiler to help you :D

Really, the issue is that bar doesn't compile, not that the impure delegate
can't be assigned.

--


More information about the Digitalmars-d-bugs mailing list