[Issue 2407] New: function pointer as an enum's base type doesn't work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 9 07:03:44 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2407
Summary: function pointer as an enum's base type doesn't work
Product: D
Version: 2.014
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: marcin.wcislo at gmail.com
Take a look at this snippet:
1. void foo() {}
2. void bar() {}
3.
4. enum Enum : void function() {
5. FOO = &foo,
6. BAR = &bar
7. }
8.
9. int main() {return 0;}
error message:
enum.d(6): Error: Integer constant expression expected instead of (& bar) < (&
foo)
enum.d(6): Error: Integer constant expression expected instead of (& bar) > (&
foo)
However, this one works fine:
1. void foo() {}
2. void bar() {}
3.
4. enum Enum : void function() {
5. FOO = &foo
6. //BAR = &bar
7. }
8.
9. int main() {return 0;}
Docs say that 'Type' can be the base of enum, where 'Type's' definition is in
"Declarations" of 2.0 and includes function pointer, so I guess the first case
is the bug.
--
More information about the Digitalmars-d-bugs
mailing list