Error: null dereference in function _Dmain

Jonathan M Davis jmdavisProg at gmx.com
Mon Jul 2 10:26:34 PDT 2012


On Monday, July 02, 2012 17:55:01 Namespace wrote:
> I'm getting this with this code: http://dpaste.dzfl.pl/55f83be6
> Can someone explain me, _why_ i get this error? o.O
> I thought D cannot detect null references by itself.

You didn't actually list what error you're seeing. The error that I'm seeing 
(which may differ from yours' because I'm on the latest master, not 2.059, and 
you're probably on 2.059) is

q.d(87): Error: constructor q.NotNull!(Foo).NotNull.this is not callable 
because it is annotated with @disable

And that error is being hit, because you're specifically trying to instatiate 
your NotNull!Foo with a null literal, and you disabled the constructor which 
would take typeof(null). The compiler isn't detecting any null references at 
all. It's complaining about your attempted use of a disabled constructor.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list