Bug 3058 – [CTFE] Cannot return out of foreach range statement

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2009-06-07T17:43:00Z
Last change time
2015-06-09T01:27:58Z
Keywords
patch, wrong-code
Assigned to
bugzilla
Creator
rsinfu
Depends on
1972

Attachments

IDFilenameSummaryContent-TypeSize
396fix_ctfe_foreachreturn.patchFix the problem (DMD 2.030)text/plain567

Comments

Comment #0 by rsinfu — 2009-06-07T17:43:33Z
Created attachment 396 Fix the problem (DMD 2.030) Return statement is not handled in ForeachRangeStatement::interpret(). As a result, the static assert in this code wrongly fails: -------------------- int foo() { foreach (i; 0 .. 1) return 1; return 0; } static assert(foo() == 1); --------------------
Comment #1 by bugzilla — 2009-09-03T13:38:48Z
Fixed dmd 2.032