[Issue 21061] New: Bad error: function D main is a nested function and cannot be accessed from reduce

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 20 22:39:11 UTC 2020


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

          Issue ID: 21061
           Summary: Bad error: function D main is a nested function and
                    cannot be accessed from reduce
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Similar to issue 11170, but not a duplicate (GDC triggers an ICE in different
locations for both tests).

This gives a bad error message. "D main" is *not* a nested function.
---
struct map(alias fun)
{
    @property run()
    {
    }
}

struct Task(Args)
{
    Args _args;
}

template reduce(functions...)
{
    auto reduce(Args)(Args args)
    {
        alias RTask = Task!(typeof(args));
        auto task = RTask();
    }
}

void main()
{
    immutable delta = 1;
    reduce!"a + b"(map!({ immutable x = delta; })());
}

--


More information about the Digitalmars-d-bugs mailing list