Currently, DMD accepts declarations of the form:

enum int foo(){writeln("foo!\n");return 123;}

which seems to be exactly equivalent to

int foo(){writeln("foo!\n");return 123;}

However, enum foo(){writeln("foo!\n");return 123;} is rejected.

Given the fact that enum is also used for declaring manifest constants, this
does seem odd. No semantic implications are added to a function declaration
when extended by the enum storage class.

I see two possibilities:

1. Disallow "enum" functions.
2. Allow, and make the "enum" function compile-time only.


Timon

Reply via email to