fix missing closing parens (in test())

This commit is contained in:
Thibault Kruse 2015-09-30 20:30:37 +02:00
parent 66630b911b
commit 4b1f9ad99c

View File

@ -11715,6 +11715,7 @@ static nefarious n; // oops, any destructor exception can't be caught
``` ```
void test() { void test() {
std::array<nefarious, 10> arr; // this line can std::terminate(!) std::array<nefarious, 10> arr; // this line can std::terminate(!)
}
``` ```
The behavior of arrays is undefined in the presence of destructors that throw because there is no reasonable rollback behavior that could ever be devised. Just think: What code can the compiler generate for constructing an `arr` where, if the fourth object's constructor throws, the code has to give up and in its cleanup mode tries to call the destructors of the already-constructed objects... and one or more of those destructors throws? There is no satisfactory answer. The behavior of arrays is undefined in the presence of destructors that throw because there is no reasonable rollback behavior that could ever be devised. Just think: What code can the compiler generate for constructing an `arr` where, if the fourth object's constructor throws, the code has to give up and in its cleanup mode tries to call the destructors of the already-constructed objects... and one or more of those destructors throws? There is no satisfactory answer.