www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5981] New: Can't used post defined constant at compile-time


           Summary: Can't used post defined constant at compile-time
           Product: D
           Version: future
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: Jesse.K.Phillips+D gmail.com
                CC: Jesse.K.Phillips+D gmail.com

--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D gmail.com> 2011-05-11
11:06:33 PDT ---
The following code compiles for 2.052 but fails in the beta for 2.053. This is
done in DFL.

break.d(3): Error: variable value cannot be read at compile time

class B {
    ushort v2 = value;
    const ushort value = 342;
void main() {

You can fix this by moving the declaration up or by defining it as an enum.

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