www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3058] New: [CTFE] Cannot return out of foreach range statement

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

           Summary: [CTFE] Cannot return out of foreach range statement
           Product: D
           Version: 2.030
          Platform: x86
        OS/Version: All
            Status: NEW
          Keywords: patch, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: rsinfu gmail.com
        Depends on: 1972


Created an attachment (id=396)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=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);
--------------------

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Walter Bright <bugzilla digitalmars.com>  2009-09-03
13:38:48 PDT ---
Fixed dmd 2.032

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2009