Let's consider this piece of code:
struct config
{
int get( )
{
if ( this == nullptr ) return 1;
return value;
}
int value = 5;
};
config* c = nullptr;
int result = c->get();
This works both in clang and gcc (I think in MSVC too). Is this (running a function on a nullptr pointer) undefined behaviour? If so (or not) where in the C++ standard is this defined as UB or allowed?