CTFE and return statement from delegate
Rajesh
joseph.rajesh at gmail.com
Tue Jul 1 14:47:26 UTC 2025
On Monday, 30 June 2025 at 14:22:47 UTC, H. S. Teoh wrote:
> On Mon, Jun 30, 2025 at 04:51:27AM +0000, Rajesh via
> Digitalmars-d-learn wrote: [...]
>> ```
>> Error: variable `__capture` cannot be read at compile time
>> onlineapp.d(27): called from here: `Problem(0).this(1)`
>> auto compile_time_var = Problem(1);
>> ```
> [...]
>
> This article may help clear up any misunderstanding that may
> have caused this problem:
>
> https://wiki.dlang.org/Compile-time_vs._compile-time
>
>
> T
Thanks for sharing this article. It's really good and cleared up
lot of details.
Sorry, but I am still not very clear why a return statement in a
delegate give this error. I assume the '__capture' variable used
to capture the surrounding variables for a delegate. Is the
return statement causing the compiler to look for return address
or something in __capture?
More information about the Digitalmars-d-learn
mailing list