[Issue 11664] New: A function with a local static variable is unusable in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 2 09:34:47 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11664

           Summary: A function with a local static variable is unusable in
                    CTFE
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: samukha at voliacable.com


--- Comment #0 from Max Samukha <samukha at voliacable.com> 2013-12-02 09:34:45 PST ---
int foo()
{
    static x = 1;
    return 0;
}
enum y = foo();

Error: Static variable x cannot be modified at compile time


The static variable is not modified. Equivalent to:

int x_private_to_foo = 1;
int foo()
{
    return 0;
}
enum y = foo();

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


More information about the Digitalmars-d-bugs mailing list