http://d.puremagic.com/issues/show_bug.cgi?id=2695

           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
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: clugd...@yahoo.com.au


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)
{
    nasty++;
    return nasty;
}

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


-- 

Reply via email to