In the below code, the output is "SFunction()". I am not finding a logical reasoning as to how this is allowed. I am compiling it using "g++ --std=c++11 references_stack_overflow.cpp"
struct S{
    S(){std::cout<<"Constructor"<<std::endl;}
    void SFunction(){std::cout<<"SFunction()"<<std::endl;}
};
void functionTakingReference(S& ref)
{
    ref.SFunction();
}
int main() {
    S* obj_ptr = nullptr;
    functionTakingReference(*obj_ptr);
    return 0;
}
