Summary: pure functions can invoke impure function pointers
           Product: D
           Version: 2.025
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD

This compiles, and it shouldn't. Interestingly, if you replace 'pure' with
'nothrow', the code is correctly rejected.
static int nasty;
int impure_evil_function(int x)
    return nasty;

pure int foo(int x)
    int function(int) a = &impure_evil_function;
    return a(x);


Reply via email to