www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21061] New: Bad error: function D main is a nested function


          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 puremagic.com
          Reporter: ibuclaw 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; })());

Jul 20 2020