Skip to content

Commit

Permalink
exception/rethrow_exception: P1675P2対応(#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohhoy committed Jan 19, 2023
1 parent bc4c31b commit ccc68e9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions reference/exception/rethrow_exception.md
Expand Up @@ -7,15 +7,25 @@
```cpp
[[noreturn]] void rethrow_exception(exception_ptr p);
```
* exception_ptr[link exception_ptr.md]
## 概要
`exception_ptr`が指す例外オブジェクトを再スローする。
## 要件
## 事前条件
`p`がヌルを指す`exception_ptr`ではないこと。
## 効果
説明用の変数`u`を、`p`が指す例外オブジェクトもしくはそのコピーとする。
コピーが行われるか否か、コピー時にメモリ確保が行われるか否かは未規定とされる。
- `u`用のメモリ確保に失敗した場合、[`bad_alloc`](/reference/new/bad_alloc.md)例外がスローされる。
- そうでなければ、`p`が指す例外オブジェクトから`u`へのコピー時に例外スローされた場合、その例外がスローされる。
- そうでなければ、`throw u;`
## 戻り値
この関数は決して返らない。
Expand Down Expand Up @@ -73,5 +83,5 @@ terminate called after throwing an instance of 'std::runtime_error'

## 参照
- [N2179 Language Support for Transporting Exceptions between Threads](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html)


- [P1675R2 `rethrow_exception` must be allowed to copy](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1675r2.pdf)
- 既存C++コンパイラの挙動にあわせて効果(Effects)文面を修正。

0 comments on commit ccc68e9

Please sign in to comment.