Undefined. Your program invokes undefined behavior by calling a method with a null pointer, so it is allowed , including your output.
Remember: the C ++ language specification does not indicate the output of each possible program to leave room for optimization. Many things are not explicitly tested and can lead to behavior that seems wrong or illogical, but just vague.
source share