You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The copy-initialization of the result of the call is sequenced before the destruction of temporaries at the end of the full-expression established by the operand of the return statement, which, in turn, is sequenced before the destruction of local variables ([stmt.jump]) of the block enclosing the return statement.
What does the which in the sentence refer to? It can be read as
"which" refers to "The copy-initialization of the result of the call"
"which" refers to "the destruction of temporaries"
According to this example:
#include<iostream>structDrop{
Drop(int id):id_(id){
}
int id_;
~Drop(){
std::cout<<"drop "<< id_<<std::endl;
}
};
intg(){
Drop x{0};
{
Drop y{1};
return ((Drop&&)Drop{2},0);
}
return1;
}
intmain(){
auto c = g();
std::cout<<"main\n";
}
The outputs are consistent in major implementations, which is
drop 2
drop 1
drop 0
main
It seems that which wants to refer to "the destruction of temporaries"
Suggested Resolution
The copy-initialization of the result of the call is sequenced before the destruction of temporaries at the end of the full-expression established by the operand of the return statement, and the destruction of the temporaries is sequenced before the destruction of local variables ([stmt.jump]) of the block enclosing the return statement.
The text was updated successfully, but these errors were encountered:
[stmt.return] p5 says:
What does the
which
in the sentence refer to? It can be read asAccording to this example:
The outputs are consistent in major implementations, which is
It seems that
which
wants to refer to "the destruction of temporaries"Suggested Resolution
The text was updated successfully, but these errors were encountered: