[Issue 6205] New: Strongly-pure nothrow functions with ignored return value are entirely stripped even if it contains a failing 'assert'.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 24 01:10:41 PDT 2011


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

           Summary: Strongly-pure nothrow functions with ignored return
                    value are entirely stripped even if it contains a
                    failing 'assert'.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-06-24 01:05:51 PDT ---
Test case:

---------------------------
int x() pure nothrow {
    assert(false, "1");
}

void main() {
    x();
}
---------------------------

This should throw an AssertError, but instead the generated program does
nothing. The AssertError will be thrown if the return value of 'x' is assigned
to some variable though. 

This bug (?) causes 'runnable/test41.d' to fail since commit 4c9661f as nothrow
inference is also implemented, making 'imports.test41a.func' a strongly-pure
nothrow function, and the 'assert' inside fails to run.

https://github.com/D-Programming-Language/dmd/commit/4c9661fa9fbd427909a334133dfc7f3869e47c31

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