This code doesn't compile (using gcc 9.3)...
int main() {
char bar = nullptr; //error: cannot convert ‘std::nullptr_t’ to ‘char’ in initialization
}
But this code does compile...
#include <array>
int main() {
std::array<char, 1> foo = {nullptr}; // foo[0] == char(0), why?
}
Why is there a distinction?
JakeSchmidt.cpp:3:32: error: cannot initialize an array element of type 'char' with an rvalue of type 'nullptr_t.