What should happen in #cpp if an exception is thrown from a local variable destructor called after executing a return statement?
What if the exception is caught and a new value returned?
GCC/Clang doesn't destruct first return-value in both cases:https://wandbox.org/permlink/EYaWoDGVeYPvWf3H …
-
Prikaži ovu nit
-
MSVC calls the destructor for the return-value in the first case, but not in the second. Is this a bug in three major compilers or am I just entering UB territory by throwing from a destructor?
0 proslijeđenih tweetova 0 korisnika označava da im se sviđaPrikaži ovu nit -
For some context - I was wondering what the behaviour should be if an exception is thrown during destruction/cleanup of local state in a coroutine after a co_return. I thought it should be consistent with normal functions. Now I'm not so sure...
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit
From the C++ WD [except.ctor]: > ... If an exception is thrown during the destruction of temporaries or local variables for a return statement, the destructor for the returned object (if any) is also invoked. ...
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.