Request for Comment assert(__ctfe)

Jacob Carlborg doob at me.com
Wed Apr 8 18:53:29 UTC 2020


On 2020-04-07 22:43, Stefan Koch wrote:
> On Tuesday, 7 April 2020 at 17:52:44 UTC, Jacob Carlborg wrote:
>>
>> void foo()
>> {
>>     assert(__ctfe);
>> }
>>
>> void main() @system
>> {
>>     try
>>         foo();
>>     catch (AssertError)
>>     {}
>> }
> 
> firstly Does anybody actually do this?

Ok, let me tweak the example a bit:

void foo()
{
     assert(__ctfe);
}

unittest
{
     foo();
}

druntime catches _all_ exceptions:

https://github.com/dlang/druntime/blob/46867186035fdf5ec2596efbb770627518ff0919/src/core/runtime.d#L617

Regardless if anyone does it or not, it's still a breaking change. Then 
we can of course argue the impact of the breaking change, how much code 
will actually break.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list