This question refers to the addition of P0593 to the latest C++20 draft .
Here is my example:
#include
#include
void foo(
The implicit object creation is supposed to happen just once, at the point of
malloc
; it isn't triggered by the assignment statement infoo
.
That's not relevant. What matters is which object gets created. The standard says that the object which gets created is one which makes something which would have been UB into well-defined code:
that operation implicitly creates and starts the lifetime of zero or more objects of implicit-lifetime types ([basic.types]) in its specified region of storage if doing so would result in the program having defined behavior.
Behavior is ultimately based on runtime execution, not static analysis. So you need only follow the execution of the program until you run into a case where behavior would not be defined, yet would be defined if an object of some type had been created in that storage at the time of the operation in question.
So the location of creation is always "the operation", but the determination of what gets created is based on how the memory gets used at runtime (ie: behavior).