www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14419] New: [CTFE] Need infinite loop detection?

https://issues.dlang.org/show_bug.cgi?id=14419

          Issue ID: 14419
           Summary: [CTFE] Need infinite loop detection?
           Product: D
           Version: D1 & D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

This was noticed and raised in GDC Bugzilla #178 because of a typo in the code.

http://bugzilla.gdcproject.org/show_bug.cgi?id=178


What it boils down to is this:
---
int foo() { while (true) { } return 1; }
enum bar = foo;  // User meant to type '&foo'
---

Perfectly valid code causing an infinite loop in CTFE.  Obviously this is a bug
vs. feature argument, but infinite loop detection should really be a feature of
CTFE to avoid accidental build bugs from occurring.

--
Apr 06 2015