In what situation can new Struct() return null?

faissaloo faissaloo at gmail.com
Sat May 11 13:40:55 UTC 2019


On Friday, 10 May 2019 at 17:54:44 UTC, H. S. Teoh wrote:
> Perhaps try Dustmite on it?
>
> AFAIK, calling new on a struct should never return null. So 
> there must be something else not quite right here.  But without 
> actual code it's anybody's guess as to what it might be.
>
> The last time I heard somebody run into this, it was caused by 
> some unrelated compiler codegen bug that left the CPU registers 
> in an inconsistent state, thus causing an unrelated call to 
> `new` to return the wrong value.  Perhaps you could try a 
> different compiler to see if that makes a difference?
>
>
> T

I've tried a number of different compilers and the issue 
persists, I think the issue is the garbage collector. This issue 
did have spontaneously disappear but generally with my project 
there seem to be a number of memory corruption issues that as far 
as I can tell, shouldn't be happening. I've submitted a bug 
report here: https://issues.dlang.org/show_bug.cgi?id=19860


More information about the Digitalmars-d-learn mailing list