void foo( std::shared_ptr< int > p, int init ) {
*p = init;
}
int seed() {
//some actions
}
foo( std::shared_ptr< int >( new int( 42 ) ), seed() );
tmp1 = new int(42);
tmp2 = seed();
tmp3 = std::shared_ptr<int>(tmp1);
foo(tmp3, tmp2);
foo(std::make_shared<int>(42), seed());
[intro.execution] Paragraph 15:
When calling a function (whether or not the function is inline), every value computation and side effect associated with any argument expression, or with the postfix expression designating the called function, is sequenced before execution of every expression or statement in the body of the called function. [ Note: Value computations and side effects associated with different argument expressions are unsequenced. — end note ] Every evaluation in the calling function (including other function calls) that is not otherwise specifically sequenced before or after the execution of the body of the called function is indeterminately sequenced with respect to the execution of the called function.