[Issue 2695] New: pure functions can invoke impure function pointers
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 27 07:20:43 PST 2009
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: bugzilla at digitalmars.com
ReportedBy: clugdbug at 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);
}
--------
--
More information about the Digitalmars-d-bugs
mailing list