www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10280] New: CTFE: Circular variable initializers should be detected properly

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

           Summary: CTFE: Circular variable initializers should be
                    detected properly
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2013-06-06 00:13:01 PDT ---
Currently, when the initializer for a variable accesses that variable in CTFE,
it's only indirectly detected via the 'recursion limit exceeded' message.
It should be detected directly.

---
const int q = foo();

int foo() { return q; }
---
rr.d(3): Error: function rr.foo CTFE recursion limit exceeded
rr.d(1):        called from here: foo()
rr.d(3):        1000 recursive calls to function foo
rr.d(3):        while evaluating q.init
rr.d(1):        called from here: foo()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 06 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10280



--- Comment #1 from github-bugzilla puremagic.com 2013-06-07 21:01:10 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/222b4786551a3852890fed1f39e7da2d8b800f40
Fix bug 10280 CTFE: Circular variable initializers should be detected properly

Use the existing 'inuse' mechanism to detect cycles.

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


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |henning still-hidden.de
         Resolution|                            |FIXED


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