[Issue 24469] non-constant nested delegate literal expression - Error on delegates causing memory corruption

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 30 13:54:00 UTC 2024


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

--- Comment #1 from Marcelo Silva Nascimento Mancini <msnmancini at hotmail.com> ---
I was able to reduce the bug:

```d
struct ExistenceChecker
{
    ///Optional. 
    bool delegate() checkExistenceFn;

}
ExistenceChecker makeExistenceChecker(string gemName)
{
    return ExistenceChecker(()
    {
        return executeShell("gem list | grep "~gemName).status == 0;
    });
}

ExistenceChecker[] chks = [
    makeExistenceChecker("test")
];
```

--


More information about the Digitalmars-d-bugs mailing list