digitalmars.D - "enum" in function declaration
- Timon Gehr (12/12) May 29 2011 Currently, DMD accepts declarations of the form:
- bearophile (5/8) May 29 2011 Don tacit regarding the word "tidy", see also:
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
May 29 2011
Timon Gehr: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.Don tacit regarding the word "tidy", see also: http://d.puremagic.com/issues/show_bug.cgi?id=3934 Bye, bearophile
May 29 2011