pure functions calling impure functions at compile-time

Simen Kjaeraas simen.kjaras at gmail.com
Wed May 23 00:52:49 PDT 2012


...do not compile. Because, you know, having done impure things, they are
tainted for life.

Example:

string foo( ) {
     return "O HAI";
}

pure void bar( ) {
     enum tmp = foo( ); // Error: pure function 'bar' cannot call impure  
function 'foo'
}

Should this be filed as a bug, or is the plan that only pure functions be
ctfe-able? (or has someone already filed it, perhaps)


More information about the Digitalmars-d-learn mailing list