[Issue 7910] New: Compiler gives error when post-contract is used in a function that returns from inside a loop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 14 08:20:58 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7910

           Summary: Compiler gives error when post-contract is used in a
                    function that returns from inside a loop
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thiezz at gmail.com


--- Comment #0 from thiezz at gmail.com 2012-04-14 08:21:46 PDT ---
When using this code with DMD32 v2.059:

int func()
out(result) { assert(result == 3); }
body
{
  while(true) {
    return 3;
  }
}

void main() {
  func();
}

The compiler produces the following error:
bug.d(1): Error: function bug.func no return exp; or assert(0); at end of
function

The error also happens when a 'for' is used instead of 'while'.

-- 
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