Catch block not hit in unittest

Lucia Cojocaru via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 24 07:35:43 PST 2016


On Thursday, 24 November 2016 at 15:18:40 UTC, Ryan wrote:
> On Thursday, 24 November 2016 at 13:42:25 UTC, Kagamin wrote:
>> Linux? Probably another bug.
>> Try this:
>> unittest
>> {
>>     import core.exception : UnicodeException;
>>     void f()
>>     {
>>         string ret;
>>         int i = -1;
>>         ret ~= i;
>>     }
>>
>>     try
>>     {
>>         f();
>>     }
>>     catch(UnicodeException e)
>>     {
>>         assert(e.msg == "Invalid UTF-8 sequence");
>>     }
>> }
>
> Both the OP's code and this code gives me a segfault on DMD 
> 2.071.1 on my Mac.

The PR this unittest is for fixes the segfault issue.
Check out: https://issues.dlang.org/show_bug.cgi?id=5995


More information about the Digitalmars-d-learn mailing list