Internally there is an entity that is the null pointer constant type. It is one of the fundamental types.
The keyword, literal and expression nullptr
has this type. decltype(nullptr)
refers to this type.
However the name std::nullptr_t
is not a keyword (not even a context-sensitive one), and so the name does not exist until declared. If you refer to the name std::nullptr_t
without declaring it, it is an error, as for any undeclared name.
So although the type exists at the start of translation like any fundamental type, the name does not exist.
In fact there are other fundamental types that do not have a "single spelling", such as short int. A short int can be refered to as short
, short int
, signed short int
, signed short
, or any permutation thereof.
It is also not dissimilar to the relationship between the typeid
operator (keyword), and the type of the typeid(...)
expression, std::typeinfo
. typeinfo
is also not a keyword and the name does not exist before being declared.
Basically, you are conflating an entity (the null pointer constant type) with a name (std::nullptr_t
)
If you ask why didn't the language designers specify nullptr_t
and typeinfo
as keywords, I would speculate that they are not common enough to risk a name collision with a user-defined name with the same spelling. Recall that such a collision would occur in any and all scopes.