Bug 10280 – CTFE: Circular variable initializers should be detected properly
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-06T00:13:00Z
Last change time
2015-06-09T05:11:55Z
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2013-06-06T00:13:01Z
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()
Comment #1 by github-bugzilla — 2013-06-07T21:01:10Z