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

          Issue ID: 12739
           Summary: Foreach delegate to opApply does not have infered
                    nothrow
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: [email protected]
          Reporter: [email protected]

This doesn't work:
struct S
{
nothrow:
    int opApply(int delegate(ref int) nothrow dg)
    {
        return 0;
    }
}

void main() nothrow
{
    S s;
    foreach (e; s)
    {
    }
}

But this does:

struct S
{
nothrow:
    int opApply(int delegate(ref int) nothrow dg)
    {
        return 0;
    }
}

void main() nothrow
{
    S s;
    s.opApply(
        (ref int x) {
            return 0;
        }
    );
}

--

Reply via email to