Error: null dereference in function _Dmain

Namespace rswhite4 at googlemail.com
Mon Jul 2 10:36:21 PDT 2012


> 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

This code: http://dpaste.dzfl.pl/a0939681
prints

dmd -w -wi -O -property -unittest -debug -of"not_null" 
"not_null.d" (im Verzeichnis: D:\D\D_Scripts\Test3)
not_null.d(106): Error: null dereference in function _Dmain
not_null.d(103): Error: null dereference in function _Dmain
Kompilierung fehlgeschlagen.

And even without

@disable
this(typeof(null));

I get the same errors.



More information about the Digitalmars-d-learn mailing list