[Issue 10280] New: CTFE: Circular variable initializers should be detected properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 6 00:13:03 PDT 2013


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 at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list