Thread overview
[Issue 2407] New: function pointer as an enum's base type doesn't work
Oct 09, 2008
d-bugmail
Jul 29, 2013
Henning Pohl
Aug 01, 2013
Henning Pohl
October 09, 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@digitalmars.com
        ReportedBy: marcin.wcislo@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.


-- 

July 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=2407


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |henning@still-hidden.de
            Summary|function pointer as an      |function pointer as an
                   |enum's base type doesn't    |enum's base type doesn't
                   |work                        |work


--- Comment #1 from Henning Pohl <henning@still-hidden.de> 2013-07-29 12:52:16 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2418

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=2407



--- Comment #2 from github-bugzilla@puremagic.com 2013-07-31 19:23:19 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1393836e36f80dfedfdc388cb0ac6b7aed08307e fix issue 2407 - function pointer as an enum's base type doesn't work

https://github.com/D-Programming-Language/dmd/commit/24042483d70805d8ffeed12046707a6b0008b9f6 Merge pull request #2418 from hpohl/2407

fix issue 2407 - function pointer as an enum's base type doesn't work

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 01, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=2407


Henning Pohl <henning@still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------