[dmd 2.066] Is scope with nothrow regression?

NCrashed via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 6 16:40:57 PDT 2014


On Sunday, 6 July 2014 at 13:04:35 UTC, Marc Schütz wrote:
> On Sunday, 6 July 2014 at 12:31:42 UTC, NCrashed wrote:
>>
>> ```
>> void bar()
>> {
>> 	throw new Exception("");
>> }
>>
>> void foo() nothrow
>> {
>> 	scope(failure) {}
>> 	bar();
>> }
>>
>> void main() {}
>> ```
>> Doesn't compile with 2.066:
>> ```
>> source/app.d(9): Error: 'app.bar' is not nothrow
>> source/app.d(6): Error: function 'app.foo' is nothrow yet may 
>> throw
>> ```
>
> This is not an error. `scope(failure)` doesn't swallow the 
> exceptions it catches, it rethrows them when it's done.

Thank you, I was expecting different behavior for a long time and 
now will use try-catch instead.


More information about the Digitalmars-d-learn mailing list