[Issue 12739] New: Foreach delegate to opApply does not have infered nothrow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 12 15:42:18 PDT 2014


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: nobody at puremagic.com
          Reporter: safety0ff.bugz at gmail.com

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;
        }
    );
}

--


More information about the Digitalmars-d-bugs mailing list