Null pointer dereferencing in D

Maxim Fomin via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 14 06:38:38 PDT 2014


On Saturday, 14 June 2014 at 12:33:28 UTC, Dicebot wrote:
> On Saturday, 14 June 2014 at 10:15:49 UTC, Marc Schütz wrote:
>> Huh? Types with `@disable this()` still have an `init` value. 
>> All it does is disallow instantiating the type without 
>> specifying an initializer (e.g. a struct literal, a value 
>> returned from a factory function, or `static opCall()`).
>
> Which is effectively a type system hole with @disable this :
>
> struct A { @disable this(); }
> auto a = A.init;

Why this is a type hole if initializer is explicitly provided?

The idea of disabled this() is to prevent default initialization,
not to reject potentially buggy one.


More information about the Digitalmars-d mailing list