Throwing specific Error Obejct for asserts

monarch_dodra monarchdodra at gmail.com
Thu Jan 10 06:34:22 PST 2013


On Thursday, 10 January 2013 at 14:31:04 UTC, monarch_dodra wrote:
> On Thursday, 10 January 2013 at 14:28:44 UTC, bearophile wrote:
>> monarch_dodra:
>>
>>> After:
>>> //----
>>> auto opSlice(size_t i, size_t j)
>>> {
>>>   version(assert)
>>>       if (i > j)
>>>           throw new RangeError();
>>> }
>>
>> But now opSlice can't be nothrow, nor transitively all the 
>> code that calls that :-(
>>
>> Bye,
>> bearophile
>
> It can because RangeError is an *Error*.
>
> I actually filed that one, and walter fixed it shortly after. ;)

Fixed by Martin Nowak actually. Apologies.

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


More information about the Digitalmars-d mailing list