[Issue 16301] CTFE execution of opApply keeps wrong "this" context in foreach's body

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 12 11:53:38 PDT 2017


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

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #2 from ag0aep6g at gmail.com ---
(In reply to Walter Bright from comment #1)
> The same error:
[...]
> happens when `enum` is replaced with `auto` so it is not specific to CTFE.

I think you're mistaken. If you leave x at the module level, it's still
initialized statically, i.e. CTFE is involved. The error goes away when x is a
function-local variable.

--


More information about the Digitalmars-d-bugs mailing list