This patch improves diagnostic for clang constexpr evaluator by adding a check for nullptr in function pointer call evaluations.
This fixes https://github.com/llvm/llvm-project/issues/59872
ex.
constexpr int foo(int (*bla)(void)) { return bla(); } static_assert(foo(nullptr) == 1);
BEFORE this patch, clang generates the following diagnostic for the code above
<source>:5:15: error: static assertion expression is not an integral constant expression static_assert(foo(nullptr) == 1); ^~~~~~~~~~~~~~~~~ <source>:2:10: note: subexpression not valid in a constant expression return bla(); ^ <source>:5:15: note: in call to 'foo(nullptr)' static_assert(foo(nullptr) == 1); ^ 1 error generated.
AFTER this patch, subexpression not valid in a constant expression note is replaced with 'bla' evaluates to a null function pointer.
Small rewording.