www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24469] New: non-constant nested delegate literal expression -

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

          Issue ID: 24469
           Summary: non-constant nested delegate literal expression -
                    Error on delegates causing memory corruption
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: msnmancini hotmail.com

I wasn't able to minimally reproduce this error. This is the code that is
causing it:

```d
Feature FeatureMakeRubyGem(
    string gemName, 
    string purpose, 
    VersionRange supportedVersion = VersionRange.init, 
    OS[] requiredOn = null, 
    Feature*[] dependencies = null
)
{
    import std.process;
    return Feature("Ruby Gem: "~gemName, purpose, ExistenceChecker([], [], (ref
Terminal t, TargetVersion v, out ExistenceStatus where)
    {
        if(executeShell("gem list | grep "~gemName).status)
        {
            where = ExistenceStatus(ExistenceStatus.Place.notFound);
            return false;
        }
        where = ExistenceStatus(ExistenceStatus.place.inPath);
        return true;
    }), Installation([], (ref Terminal t, ref RealTimeConsoleInput input,
TargetVersion ver, Download[] content)
    {
        return wait(spawnShell("sudo gem install "~gemName)) == 0;
    }), null, supportedVersion, requiredOn, dependencies);
}
```

More information on LDC Repository:
https://github.com/ldc-developers/ldc/issues/4610 since this is catched as an
error by LDC

--
Mar 30