Skip to content

Commit cd443ea

Browse files
stdexcept関係のconstexpr対応 (#1433)
1 parent 90e27bd commit cd443ea

21 files changed

+406
-26
lines changed

lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const auto d = hello("Adolph Blaine Charles David Earl Frederick Gerald Hubert I
5454
- [`std::bad_array_new_length`](/reference/new/bad_array_new_length.md)
5555
- [`std::bad_cast`](/reference/typeinfo/bad_cast.md)
5656
- [`std::bad_typeid`](/reference/typeinfo/bad_typeid.md)
57+
- [`<stdexcept>`](/reference/stdexcept.md)
58+
- [`std::bad_expected_access`](/reference/expected/bad_expected_access.md)
5759
5860
5961
## 参照

reference/expected/bad_expected_access/error.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
* cpp23[meta cpp]
77

88
```cpp
9-
constexpr const E& error() const & noexcept; // (1)
10-
constexpr E& error() & noexcept; // (2)
11-
constexpr const E&& error() const && noexcept; // (3)
12-
constexpr E&& error() && noexcept; // (4)
9+
const E& error() const & noexcept; // (1) C++23
10+
constexpr const E& error() const & noexcept; // (1) C++26
11+
12+
E& error() & noexcept; // (2) C++23
13+
constexpr E& error() & noexcept; // (2) C++26
14+
15+
const E&& error() const && noexcept; // (3) C++23
16+
constexpr const E&& error() const && noexcept; // (3) C++26
17+
18+
E&& error() && noexcept; // (4) C++23
19+
constexpr E&& error() && noexcept; // (4) C++26
1320
```
1421

1522
## 概要
@@ -66,6 +73,12 @@ throw:ERR
6673
- [Visual C++](/implementation.md#visual_cpp): ??
6774

6875

76+
## 関連項目
77+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
78+
79+
6980
## 参照
7081
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
7182
- [P2549R1 `std::unexpected<E>` should have `error()` as member accessor](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2549r1.html)
83+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
84+
- C++26で`constexpr`対応した

reference/expected/bad_expected_access/op_constructor.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
* cpp23[meta cpp]
77

88
```cpp
9-
explicit bad_expected_access(E e); // (1)
10-
bad_expected_access(const bad_expected_access&); // (2)
11-
bad_expected_access(bad_expected_access&&); // (3)
9+
explicit bad_expected_access(E e); // (1) C++23
10+
constexpr explicit bad_expected_access(E e); // (1) C++26
11+
12+
bad_expected_access(const bad_expected_access&); // (2) C++23
13+
constexpr bad_expected_access(const bad_expected_access&); // (2) C++26
14+
15+
bad_expected_access(bad_expected_access&&); // (3) C++23
16+
constexpr bad_expected_access(bad_expected_access&&); // (3) C++26
1217
```
1318
* bad_expected_access[link ../bad_expected_access.md]
1419
@@ -48,5 +53,11 @@ int main()
4853
- [Visual C++](/implementation.md#visual_cpp): ??
4954

5055

56+
## 関連項目
57+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
58+
59+
5160
## 参照
5261
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
62+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
63+
- C++26で`constexpr`対応した

reference/expected/bad_expected_access/what.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* cpp23[meta cpp]
77

88
```cpp
9-
const char* what() const noexcept override;
9+
const char* what() const noexcept override; // (1) C++23
10+
constexpr const char* what() const noexcept override; // (1) C++26
1011
```
1112

1213
## 概要
@@ -60,5 +61,11 @@ bad access to std::expected without expected value
6061
- [Visual C++](/implementation.md#visual_cpp): ??
6162

6263

64+
## 関連項目
65+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
66+
67+
6368
## 参照
6469
- [P0323R12 std::expected](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html)
70+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
71+
- C++26で`constexpr`対応した

reference/format/format_error.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@
66

77
```cpp
88
namespace std {
9-
class format_error : public runtime_error {
10-
public:
11-
explicit format_error(const string& what_arg);
12-
explicit format_error(const char* what_arg);
13-
};
9+
class format_error : public runtime_error;
1410
}
1511
```
16-
* string[link /reference/string/basic_string.md]
1712
1813
## 概要
1914
`<format>`の各機能の失敗を表す例外クラス。ユーザー定義フォーマッターもこの例外を投げることができる。
2015
2116
## メンバ関数
2217
### 構築・破棄
2318
24-
| 名前 | 説明 | 対応バージョン |
25-
|-----------------|----------------|----------------|
26-
| `(constructor)` | コンストラクタ | C++20 |
19+
| 名前 | 説明 | 対応バージョン |
20+
|------|------|----------------|
21+
| [(constructor)](format_error/op_constructor.md) | コンストラクタ | C++20 |
22+
| [(destructor)](format_error/op_destructor.md) | デストラクタ | C++20 |
23+
| [`operator=`](format_error/op_assign.md) | 代入演算子 | C++20 |
24+
| [`what`](format_error/what.md) | エラー理由を取得する | C++20 |
25+
2726
2827
## バージョン
2928
### 言語
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# operator=
2+
* format[meta header]
3+
* std[meta namespace]
4+
* format_error[meta class]
5+
* function[meta id-type]
6+
* cpp20[meta cpp]
7+
8+
```cpp
9+
format_error& operator=(const format_error&) noexcept; // (1) C++20
10+
constexpr format_error& operator=(const format_error&) noexcept; // (1) C++26
11+
```
12+
13+
## 概要
14+
`format_error`オブジェクトを代入する
15+
16+
- (1) : コピー代入
17+
18+
19+
## 例外
20+
投げない
21+
22+
23+
## 関連項目
24+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
25+
26+
27+
## 参照
28+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
29+
- C++26で`constexpr`対応した
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# コンストラクタ
2+
* format[meta header]
3+
* std[meta namespace]
4+
* format_error[meta class]
5+
* function[meta id-type]
6+
* cpp20[meta cpp]
7+
8+
```cpp
9+
explicit format_error(const string& what_arg); // (1) C++20
10+
constexpr explicit format_error(const string& what_arg); // (1) C++26
11+
12+
explicit format_error(const char* what_arg); // (2) C++20
13+
constexpr explicit format_error(const char* what_arg); // (2) C++26
14+
```
15+
16+
## 概要
17+
`format_error`オブジェクトを構築する。
18+
19+
- (1) : `std::string`オブジェクトでエラー理由を受け取る
20+
- (2) : `const char*`でエラー理由を受け取る
21+
22+
23+
## 事後条件
24+
25+
- (1) : `strcmp(what(), what_arg.c_str()) == 0`
26+
- (2) : `strcmp(what(), what_arg) == 0`
27+
28+
29+
## 関連項目
30+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
31+
32+
33+
## 参照
34+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
35+
- C++26で`constexpr`対応した
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# デストラクタ
2+
* format[meta header]
3+
* std[meta namespace]
4+
* format_error[meta class]
5+
* function[meta id-type]
6+
* cpp20[meta cpp]
7+
8+
```cpp
9+
virtual ~format_error(); // (1) C++20
10+
constexpr virtual ~format_error(); // (1) C++26
11+
```
12+
13+
## 概要
14+
`format_error`オブジェクトを破棄する。
15+
16+
17+
## 例外
18+
投げない
19+
20+
21+
## 関連項目
22+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
23+

reference/format/format_error/what.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# what
2+
* format[meta header]
3+
* std[meta namespace]
4+
* format_error[meta class]
5+
* function[meta id-type]
6+
* cpp20[meta cpp]
7+
8+
```cpp
9+
const char* what() const noexcept override; // (1) C++20
10+
constexpr const char* what() const noexcept override; // (1) C++26
11+
```
12+
13+
## 概要
14+
エラー理由となる実装依存文字列を取得する。
15+
16+
17+
## 例外
18+
投げない
19+
20+
21+
## 関連項目
22+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
23+
24+
25+
## 参照
26+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
27+
- C++26で`constexpr`対応した

reference/new/bad_array_new_length/op_destructor.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* cpp11[meta cpp]
77

88
```cpp
9-
virtual ~bad_array_new_length(); // (1) C++03
9+
virtual ~bad_array_new_length(); // (1) C++11
1010
constexpr virtual ~bad_array_new_length(); // (1) C++26
1111
```
1212

reference/optional/bad_optional_access.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ namespace std {
1919
2020
| 名前 | 説明 | 対応バージョン |
2121
|------|------|----------------|
22-
| `bad_optional_access();` | デフォルトコンストラクタ | C++17 |
23-
| `virtual const char* what() const noexcept;` | エラー理由となる実装依存文字列 | C++17 |
22+
| [(constructor)](bad_optional_access/op_constructor.md) | コンストラクタ | C++17 |
23+
| [(destructor)](bad_optional_access/op_destructor.md) | デストラクタ | C++17 |
24+
| [`operator=`](bad_optional_access/op_assign.md) | 代入演算子 | C++17 |
25+
| [`what`](bad_optional_access/what.md) | エラー理由を取得する | C++17 |
2426
2527
2628
## 例
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# operator=
2+
* optional[meta header]
3+
* std[meta namespace]
4+
* bad_optional_access[meta class]
5+
* function[meta id-type]
6+
* cpp17[meta cpp]
7+
8+
```cpp
9+
bad_optional_access& operator=(const bad_optional_access&) noexcept; // (1) C++17
10+
constexpr bad_optional_access& operator=(const bad_optional_access&) noexcept; // (1) C++26
11+
```
12+
13+
## 概要
14+
`bad_optional_access`オブジェクトを代入する
15+
16+
- (1) : コピー代入
17+
18+
19+
## 例外
20+
投げない
21+
22+
23+
## 関連項目
24+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
25+
26+
27+
## 参照
28+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
29+
- C++26で`constexpr`対応した
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# コンストラクタ
2+
* optional[meta header]
3+
* std[meta namespace]
4+
* bad_optional_access[meta class]
5+
* function[meta id-type]
6+
* cpp17[meta cpp]
7+
8+
```cpp
9+
bad_optional_access() noexcept; // (1) C++17
10+
constexpr bad_optional_access() noexcept; // (1) C++26
11+
12+
bad_optional_access(const bad_optional_access&) noexcept; // (2) C++17
13+
constexpr bad_optional_access(const bad_optional_access&) noexcept; // (2) C++26
14+
```
15+
16+
## 概要
17+
`bad_optional_access`オブジェクトを構築する。
18+
19+
- (1) : デフォルトコンストラクタ
20+
- (2) : コピーコンストラクタ
21+
22+
23+
## 例外
24+
投げない
25+
26+
27+
## 関連項目
28+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
29+
30+
31+
## 参照
32+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
33+
- C++26で`constexpr`対応した
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# デストラクタ
2+
* optional[meta header]
3+
* std[meta namespace]
4+
* bad_optional_access[meta class]
5+
* function[meta id-type]
6+
* cpp17[meta cpp]
7+
8+
```cpp
9+
virtual ~bad_optional_access(); // (1) C++17
10+
constexpr virtual ~bad_optional_access(); // (1) C++26
11+
```
12+
13+
## 概要
14+
`bad_array_new_length`オブジェクトを破棄する。
15+
16+
17+
## 例外
18+
投げない
19+
20+
21+
## 関連項目
22+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# what
2+
* optional[meta header]
3+
* std[meta namespace]
4+
* bad_optional_access[meta class]
5+
* function[meta id-type]
6+
* cpp17[meta cpp]
7+
8+
```cpp
9+
const char* what() const noexcept override; // (1) C++17
10+
constexpr const char* what() const noexcept override; // (1) C++26
11+
```
12+
13+
## 概要
14+
エラー理由となる実装依存文字列を取得する。
15+
16+
17+
## 例外
18+
投げない
19+
20+
21+
## 関連項目
22+
- [C++26 定数評価での例外送出を許可](/lang/cpp26/allowing_exception_throwing_in_constant-evaluation.md)
23+
24+
25+
## 参照
26+
- [P3378R2 `constexpr` exception types](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3378r2.html)
27+
- C++26で`constexpr`対応した

0 commit comments

Comments
 (0)