Summary: Function using enforce() cannot be inferred as @safe
                    because of the lazy argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-02-06 13:22:40 PST ---
Test case:

import std.exception;
int f7452()(int x)
   enforce(x > 0);
   return x;
void g7452() @safe pure
   assert(4 == f7452(4));

This caused error:

    Error: safe function 'g7452' cannot call system function 'f7452'

This is because of the lazy argument, as shown with this minimal D-only test

void e7452b(int, lazy int) pure nothrow @safe {}
int f7452b()(int x)
   e7452b(x, 0);
   return x;
void g7452b() pure nothrow @safe
   assert(4 == f7452b(4));

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to