mgehre/llvm-project

Returning a null pointer should be fine

Closed this issue · 1 comments

Short reproduction (because creduce is awesome):

int *a() { return __null; }

emits:

/tmp/tmp.fRNdhfhcDt/foo.cxx:1:12: warning: returning a null pointer where a non-null pointer is expected [-Wlifetime-null]
int *a() { return __null; }
           ^~~~~~~~~~~~~

Why is non-null expected?

Yes, that's clearly a bug.