In the C++11 standard, I don\'t understand the reason why taking the address of nullptr is disallowed whereas one is allowed to take the address of their own st
nullptr
is a (literal) constant, and these don't have a memory address, like any other literal constant in your code. It's similar to 0
, but of the special std::nullptr_t
type instead of void*
to avoid problems with overloading (pointers vs. integers).
But if you define your own variable with the value nullptr
, it has a memory address, so you can take its address.
The same holds for any other literal constant (which in C++ fall under the category prvalue) of any other type, since literal constants aren't stored in your program (only as parts of expressions where they occur), that's why it doesn't make any sense to talk about addresses. However, constant variables do have addresses, to point out the difference.