www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2414] New: enum is dynamically evaluated, yum

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2414

           Summary: enum is dynamically evaluated, yum
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


Just compile this, run it, and have a laugh:

import std.stdio;

void main() 
{
    double a = 1, b = 2;
    enum c = a + b;
    writeln(c);
    a = 2, b = 3;
    writeln(c);
}


-- 
Oct 12 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2414






It's a macro!  Weee!


-- 
Oct 12 2008
prev sibling next sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
d-bugmail puremagic.com wrote:
 http://d.puremagic.com/issues/show_bug.cgi?id=2414
 
            Summary: enum is dynamically evaluated, yum
            Product: D
            Version: unspecified
           Platform: PC
         OS/Version: Linux
             Status: NEW
           Severity: normal
           Priority: P2
          Component: DMD
         AssignedTo: bugzilla digitalmars.com
         ReportedBy: andrei metalanguage.com
 
 
 Just compile this, run it, and have a laugh:
 
 import std.stdio;
 
 void main() 
 {
     double a = 1, b = 2;
     enum c = a + b;
     writeln(c);
     a = 2, b = 3;
     writeln(c);
 }
 
 
... :S -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Oct 17 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2414


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg gmail.com



On trunk dmd (d36b3b12fc4814e59f3a0d680b8700e787b1ceff),
----
test.d(6): Error: variable a cannot be read at compile time
test.d(6): Error: variable b cannot be read at compile time
----

It seems to me that this issue has been resolved.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 19 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2414


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kennytm gmail.com
         Resolution|                            |FIXED



This has been fixed in commit fc67 "Ensure compile-time constants are not
variables(!)". Thanks Don. There should be a test case though.

https://github.com/D-Programming-Language/dmd/commit/fc67046cf1e66182d959309fb15ef9e2d4c266b9

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