Automatic invariant generation

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 9 05:44:21 PDT 2017


On 7/9/17 8:04 AM, Timon Gehr wrote:
> On 09.07.2017 13:57, Steven Schveighoffer wrote:
>> 3. Classes are where you might see this issue, as people declare a 
>> class and try to use it without allocating one all the time. But in 
>> this case, when you are calling a virtual function, the segfault 
>> occurs before the assert can ever be used.
> 
> What about final member functions?

It's possible one has a final class, and does experience this. But it's 
not likely -- most people don't think about virtual by default, and just 
have virtual functions.

Or the final member functions are called after attempting to access 
members or virtual functions.

Or you just learn not to leave class instances uninitialized (most 
have), and you never see the error.

I'll also note that dmd 2.050 still segfaults even for final functions. 
2.060 doesn't. I didn't test in between. So at least as far back as 
2.050, this was a wasted assert.

-Steve


More information about the Digitalmars-d mailing list