Bug 3269 – pure functions silently become nothrow

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-08-28T11:05:00Z
Last change time
2015-06-09T01:20:08Z
Keywords
patch, wrong-code
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2009-08-28T11:05:13Z
class A { pure static void raise(string s) { throw new Exception(s); } } void main() { A.raise("a"); } This code compiles and runs without an error!
Comment #1 by clugdbug — 2009-10-27T12:22:53Z
// A pure function might have side effects, unless it is also nothrow. // PATCH: e2ir.c, line 288. e = el_una(op,tyret,ep); } else if (ep) { - e = el_bin(tf->ispure ? OPcallns : OPcall,tyret,ec,ep); + e = el_bin((tf->ispure && tf->isnothrow) ? OPcallns : OPcall,tyret,ec,ep); } else { - e = el_una(tf->ispure ? OPucallns : OPucall,tyret,ec); + e = el_una((tf->ispure && tf->isnothrow) ? OPucallns : OPucall,tyret,ec); } if (retmethod == RETstack)
Comment #2 by leandro.lucarella — 2009-10-29T14:38:17Z
Comment #3 by bugzilla — 2009-11-06T11:33:47Z
Fixed dmd 2.036