www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11664] New: A function with a local static variable is unusable in CTFE

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: samukha voliacable.com


--- Comment #0 from Max Samukha <samukha 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: -------
Dec 02 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11664


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, pull
            Version|unspecified                 |D2


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-12-02 17:33:42 PST ---
https://github.com/D-Programming-Language/dmd/pull/2917

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11664



--- Comment #2 from github-bugzilla puremagic.com 2013-12-03 15:53:10 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/cb0c6096e93a9885a269005cd8379a3627112207
fix Issue 11664 - A function with a local static variable is unusable in CTFE

https://github.com/D-Programming-Language/dmd/commit/70885936ba13b609df794ab3ead15c24c4afd870
Merge pull request #2917 from 9rnsr/fix11664

Issue 11664 - A function with a local static variable is unusable in CTFE

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 03 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11664


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

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


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