Hi!
There is strange behaviour of nullable const pointer.
Lets say I have function f.
int f(int* _Nonnull i) {
return *i;
}
And code like this:
int main() {
int* _Nullable p = 0;
return f(p);
}
produces error as expected, if I pass -Wnullable-to-nonnull-conversion
$ clang t.c -Werror -Wnullable-to-nonnull-conversion
t.c:7:12: error: implicit conversion from nullable pointer ‘int * _Nullable’ to non-nullable pointer type ‘int * _Nonnull’ [-Werror,-Wnullable-to-nonnull-conversion]
return f(p);
^
1 error generated.
But, if I change code like so
int main() {
int* _Nullable const p = 0;
return f(p);
}
compiler does not produces any errors.
It looks very strange.