http://d.puremagic.com/issues/show_bug.cgi?id=3021

           Summary: D1 CTFE and enums produces error '... constant
                    expression expected'
           Product: D
           Version: 1.044
          Platform: PC
               URL: http://www.digitalmars.com/d/1.0/enum.html
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: g...@nwawudu.com


Using CTFE and enums produces an error in D1, both examples compile in D2.

test1.d
------
int b() { return 10; }
enum { a = b() }

C:>dmd test1.d
test1.d(2): Error: Integer constant expression expected instead of b()


test2.d
------
int b() { return 10; }
enum { a = b }

C:>dmd test2.d
test2.d(2): Error: cannot implicitly convert expression (b) of type int() to
int
test2.d(2): Error: Integer constant expression expected instead of cast(int)b


The following is OK in D1.
int b() { return 10; }
const int x = b();
enum { a = x }

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

Reply via email to