Undefined Behavior is the short answer. The long answer is that because your class has no virtual methods calling them directly is just a function call with an implicit this
parameter that points to the memory you've allocated. That said if any of your methods were to access this
it would cause more undefined behavior because the object hasn't been constructed.
blatantly stolen from Columbo and LRIO:
[C++11: 3.8/1]:
The lifetime of an object is a runtime property of the object. An object is said to have non-trivial initialization if it is of a class or aggregate type and it or one of its members is initialized by a constructor other than a trivial default constructor. [ Note: initialization by a trivial copy/move constructor is non-trivial initialization. —end note ]
The critical bit there is the it the pointer to the object can contain data other than just a place where the members are stored. It is up to the implementation to decide what that is.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…