November 03, 2019 [Issue 3924] nothrow ignored in some situations | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3924 Nicholas Wilson <iamthewilsonator@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |iamthewilsonator@hotmail.co | |m Resolution|--- |WORKSFORME --- Comment #3 from Nicholas Wilson <iamthewilsonator@hotmail.com> --- Examples given no longer compile: void main() { nothrow void delegate() c = { throw new Exception(""); }; c(); } gives onlineapp.d(2): Error: cannot implicitly convert expression __lambda1 of type void delegate() pure @safe to void delegate() nothrow onlineapp.d(2): Error: cannot implicitly convert expression __lambda1 of type void delegate() pure @safe to void delegate() nothrow nothrow auto foo() { throw new Exception(""); } void main() { foo(); } gives onlineapp.d(2): Error: object.Exception is thrown but not caught onlineapp.d(1): Error: nothrow function onlineapp.foo may throw nothrow auto foo() { auto c = { throw new Exception(""); }; c(); } void main() { foo(); } onlineapp.d(3): Error: c is not nothrow onlineapp.d(1): Error: nothrow function onlineapp.foo may throw -- |
Copyright © 1999-2021 by the D Language Foundation