Skip to content

Commit 4da2b4e

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 6b2d759 commit 4da2b4e

5 files changed

Lines changed: 82 additions & 65 deletions

File tree

lang/cpp11/static_assert.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-04-06T14:09:24+09:00">
193-
2026年04月06日 14時09分24秒 (JST)
192+
datetime="2026-09-15T16:15:49+09:00">
193+
2026年09月15日 16時15分49秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -266,7 +266,7 @@ <h2>仕様</h2>
266266
<li>この宣言は、名前空間スコープ、ブロックスコープ、メンバ宣言といった場所で記述できる</li>
267267
<li>定数式が真であると評価された場合は何も効果がない。定数式が偽であると評価された場合は、指定された文字列リテラルを含む<a class="cpprefjp-defined-word" data-desc="診断情報。コンパイルエラーや警告。処理系がプログラム翻訳時に提供する情報の総称" href="../../implementation-compliance.html#dfn-diagnostic-message">診断メッセージ</a>がコンパイラによって問題報告される。ただし、基本ソース文字集合に含まれない文字集合は、<a class="cpprefjp-defined-word" data-desc="診断情報。コンパイルエラーや警告。処理系がプログラム翻訳時に提供する情報の総称" href="../../implementation-compliance.html#dfn-diagnostic-message">診断メッセージ</a>に表示することはコンパイラに要求されない</li>
268268
<li><code>static_assert</code>宣言では、新たな型やオブジェクトは宣言しない。また、実行時にサイズや時間コストは発生しない</li>
269-
<li>(CWG 2518が適用された環境): template文(もしくは適切な特殊化や<a href="../cpp17/if_constexpr.html">C++17 constexpr if 文</a>の中の文)が実際にインスタンス化されるまで、<code>static_assert</code>文の宣言は遅延される<ul>
269+
<li>(CWG 2518が適用された環境): 失敗する<code>static_assert</code>宣言があっても、その宣言自体が実体化されない限りコンパイルエラーにはならない。テンプレートが実体化されない場合と、<a href="../cpp17/if_constexpr.html">C++17 constexpr if 文</a>の廃棄文に含まれる場合がこれに該当する<ul>
270270
<li><a href="../cpp17/if_constexpr.html">C++17 constexpr if 文</a>の解説を参照</li>
271271
</ul>
272272
</li>

lang/cpp17/if_constexpr.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-08-07T23:50:00+09:00">
193-
2026年08月07日 23時50分00秒 (JST)
192+
datetime="2026-09-15T16:15:49+09:00">
193+
2026年09月15日 16時15分49秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
197-
<span itemprop="name">rotarymars</span>
197+
<span itemprop="name">Akira Takahashi</span>
198198
</span>
199199
が更新
200200
</small></p>
@@ -325,7 +325,7 @@ <h2>仕様</h2>
325325
</code></pre></div>
326326
</div></p>
327327
<h3><code>static_assert</code>宣言に関する<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a></h3>
328-
<p>後に述べる2段階名前探索に関する注意点とは関係なく、C++23以降、もしくはCWG 2518が適用された環境においては、template文(もしくは適切な特殊化や<code>constexpr if</code>文の中の文)が実際に実体化されない限り、<code>static_assert</code>宣言による失敗は無視される</p>
328+
<p>後に述べる2段階名前探索に関する注意点とは関係なく、C++23以降、もしくはCWG 2518が適用された環境においては、失敗する<code>static_assert</code>宣言があっても、その宣言自体が実体化されない限りコンパイルエラーにはならない。テンプレートが実体化されない場合と、<code>constexpr if</code>文の廃棄文に含まれる場合がこれに該当する</p>
329329
<p><div class="yata" id="ec4607d93fa8a96d37d0511480bb2b3162325756"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../../reference/cstdint.html">&lt;cstdint&gt;</a></span>
330330
<span class="k">template</span><span class="w"> </span><span class="o">&lt;</span><span class="k">class</span><span class="w"> </span><span class="nc">T</span><span class="o">&gt;</span>
331331
<span class="kt">void</span><span class="w"> </span><span class="n">f</span><span class="p">(</span><span class="n">T</span><span class="w"> </span><span class="n">t</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
@@ -366,9 +366,9 @@ <h3>2段階名前探索における注意点</h3>
366366
<span class="p">}</span>
367367
</code></pre></div>
368368
</div></p>
369-
<p>なぜならば廃棄文はテンプレートの実体化を防ぐ (依存名の検証をしない) だけで、非依存名は検証されるからである。この例の<code><a href="../cpp11/static_assert.html">static_assert</a></code>に渡す条件式はテンプレートパラメータに依存していないので、テンプレートの宣言時に検証され、エラーとなる。</p>
369+
<p>なぜならば廃棄文はテンプレートの実体化を防ぐ (依存名の検証をしない) だけで、非依存名は検証されるからである。この例の<code><a href="../cpp11/static_assert.html">static_assert</a></code>に渡す条件式はテンプレートパラメータに依存していないので、テンプレートの定義時に検証され、エラーとなる。</p>
370370
<h4>CWG 2518が適用されていない環境での回避策</h4>
371-
<p>言い換えれば<code>static_assert</code>に渡す条件式が依存名ならばテンプレートの宣言時に検証されず、テンプレート実体化まで評価を遅らせることができる。</p>
371+
<p>言い換えれば<code>static_assert</code>に渡す条件式が依存名ならばテンプレートの定義時に検証されず、テンプレート実体化まで評価を遅らせることができる。</p>
372372
<p><div class="yata" id="016c0cb7f0bd47484625130ad9cfab5b0b5ef0e0"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../../reference/type_traits.html">&lt;type_traits&gt;</a></span>
373373

374374
<span class="k">template</span><span class="w"> </span><span class="o">&lt;</span><span class="k">typename</span><span class="w"> </span><span class="nc">T</span><span class="o">&gt;</span>

reference/chrono/make24.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ <h2>例</h2>
263263
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">false</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">0h</a></span><span class="p">);</span>
264264

265265
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">);</span>
266-
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">1h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">1</span><span class="n"><a href="duration/op_h.html">3h</a></span><span class="p">);</span>
266+
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">1h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">1u</span><span class="n">KMnekOqvbTTfCDaeUirBLQDPNUUYkts</span><span class="p">);</span>
267267
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">3h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">15h</a></span><span class="p">);</span>
268268
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">11h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">23h</a></span><span class="p">);</span>
269269
<span class="p">}</span>

rss.xml

Lines changed: 70 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,78 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<link href="https://cpprefjp.github.io" />
5-
<updated>2026-09-15T07:07:30.860462</updated>
6-
<id>75bf7dc4-5dab-4af7-a174-dba14a7be441</id>
5+
<updated>2026-09-15T07:18:00.359297</updated>
6+
<id>919fb5b9-6fb8-4e65-a580-1c586d875cde</id>
77

88

9+
<entry>
10+
<title>コンパイル時アサート [N1720] -- if constexpr周りの整理 #1260</title>
11+
<link href="https://cpprefjp.github.io/lang/cpp11/static_assert.html"/>
12+
<id>6b0724b0e03136e3503aef084ffadd8ac2c6b31b:lang/cpp11/static_assert.md</id>
13+
<updated>2026-09-15T16:15:49+09:00</updated>
14+
15+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/lang/cpp11/static_assert.md b/lang/cpp11/static_assert.md
16+
index 8787129d1..eb2c73cd8 100644
17+
--- a/lang/cpp11/static_assert.md
18+
+++ b/lang/cpp11/static_assert.md
19+
@@ -38,7 +38,7 @@ static_assert(定数式, 文字列リテラル);
20+
- この宣言は、名前空間スコープ、ブロックスコープ、メンバ宣言といった場所で記述できる
21+
- 定数式が真であると評価された場合は何も効果がない。定数式が偽であると評価された場合は、指定された文字列リテラルを含む診断メッセージがコンパイラによって問題報告される。ただし、基本ソース文字集合に含まれない文字集合は、診断メッセージに表示することはコンパイラに要求されない
22+
- `static_assert`宣言では、新たな型やオブジェクトは宣言しない。また、実行時にサイズや時間コストは発生しない
23+
-- (CWG 2518が適用された環境): template文(もしくは適切な特殊化や[C++17 constexpr if 文](/lang/cpp17/if_constexpr.md)の中の文)が実際にインスタンス化されるまで、`static_assert`文の宣言は遅延される。
24+
+- (CWG 2518が適用された環境): 失敗する`static_assert`宣言があっても、その宣言自体が実体化されない限りコンパイルエラーにはならない。テンプレートが実体化されない場合と、[C++17 constexpr if 文](/lang/cpp17/if_constexpr.md)の廃棄文に含まれる場合がこれに該当する。
25+
- [C++17 constexpr if 文](/lang/cpp17/if_constexpr.md)の解説を参照
26+
27+
## 例
28+
&lt;/code&gt;&lt;/pre&gt;</summary>
29+
30+
<author>
31+
<name>Akira Takahashi</name>
32+
<email>faithandbrave@gmail.com</email>
33+
</author>
34+
</entry>
35+
36+
<entry>
37+
<title>constexpr if 文 [P0292R2] -- if constexpr周りの整理 #1260</title>
38+
<link href="https://cpprefjp.github.io/lang/cpp17/if_constexpr.html"/>
39+
<id>6b0724b0e03136e3503aef084ffadd8ac2c6b31b:lang/cpp17/if_constexpr.md</id>
40+
<updated>2026-09-15T16:15:49+09:00</updated>
41+
42+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/lang/cpp17/if_constexpr.md b/lang/cpp17/if_constexpr.md
43+
index d18207ac8..b5a3ae3cc 100644
44+
--- a/lang/cpp17/if_constexpr.md
45+
+++ b/lang/cpp17/if_constexpr.md
46+
@@ -102,7 +102,7 @@ int main()
47+
48+
### `static_assert`宣言に関する例外
49+
50+
-後に述べる2段階名前探索に関する注意点とは関係なく、C++23以降、もしくはCWG 2518が適用された環境においては、template文(もしくは適切な特殊化や`constexpr if`文の中の文)が実際に実体化されない限り、`static_assert`宣言による失敗は無視される。
51+
+後に述べる2段階名前探索に関する注意点とは関係なく、C++23以降、もしくはCWG 2518が適用された環境においては、失敗する`static_assert`宣言があっても、その宣言自体が実体化されない限りコンパイルエラーにはならない。テンプレートが実体化されない場合と、`constexpr if`文の廃棄文に含まれる場合がこれに該当する。
52+
53+
```cpp example
54+
#include &amp;lt;cstdint&amp;gt;
55+
@@ -149,11 +149,11 @@ int main()
56+
}
57+
```
58+
59+
-なぜならば廃棄文はテンプレートの実体化を防ぐ (依存名の検証をしない) だけで、非依存名は検証されるからである。この例の[`static_assert`](/lang/cpp11/static_assert.md)に渡す条件式はテンプレートパラメータに依存していないので、テンプレートの宣言時に検証され、エラーとなる。
60+
+なぜならば廃棄文はテンプレートの実体化を防ぐ (依存名の検証をしない) だけで、非依存名は検証されるからである。この例の[`static_assert`](/lang/cpp11/static_assert.md)に渡す条件式はテンプレートパラメータに依存していないので、テンプレートの定義時に検証され、エラーとなる。
61+
62+
#### CWG 2518が適用されていない環境での回避策
63+
64+
-言い換えれば`static_assert`に渡す条件式が依存名ならばテンプレートの宣言時に検証されず、テンプレート実体化まで評価を遅らせることができる。
65+
+言い換えれば`static_assert`に渡す条件式が依存名ならばテンプレートの定義時に検証されず、テンプレート実体化まで評価を遅らせることができる。
66+
67+
```cpp example
68+
#include &amp;lt;type_traits&amp;gt;
69+
&lt;/code&gt;&lt;/pre&gt;</summary>
70+
71+
<author>
72+
<name>Akira Takahashi</name>
73+
<email>faithandbrave@gmail.com</email>
74+
</author>
75+
</entry>
76+
977
<entry>
1078
<title>constexpr if 文 [P0292R2] -- Merge pull request #1260 from cpprefjp/refactor/cwg2518</title>
1179
<link href="https://cpprefjp.github.io/lang/cpp17/if_constexpr.html"/>
@@ -381,55 +449,4 @@ index 1f4ab34e9..6d93d39cc 100644
381449
</author>
382450
</entry>
383451

384-
<entry>
385-
<title>暗黙のラムダキャプチャを簡略化 [P0588R1] -- feat: P0588R1で追加されたodr-usableについて記述</title>
386-
<link href="https://cpprefjp.github.io/lang/cpp20/simplifying_implicit_lambda_capture.html"/>
387-
<id>51022b16e885b1294391276a21c8577006c08e9d:lang/cpp20/simplifying_implicit_lambda_capture.md</id>
388-
<updated>2023-01-11T00:44:41+09:00</updated>
389-
390-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/lang/cpp20/simplifying_implicit_lambda_capture.md b/lang/cpp20/simplifying_implicit_lambda_capture.md
391-
index 8fbce21ed..1f4ab34e9 100644
392-
--- a/lang/cpp20/simplifying_implicit_lambda_capture.md
393-
+++ b/lang/cpp20/simplifying_implicit_lambda_capture.md
394-
@@ -29,12 +29,31 @@ void f() {
395-
}
396-
```
397-
398-
-構造化束縛で導入された名前はラムダ式でキャプチャできない、と明記された。しかしその後、「[構造化束縛を拡張して通常の変数宣言のように使用できるようにする](extending_structured_bindings_to_be_more_like_variable_declarations.md)」の仕様でそれが可能となったため、この仕様変更は打ち消された。
399-
+本提案では一旦、構造化束縛で導入された名前はラムダ式でキャプチャできない、と明記された。その後、「[構造化束縛を拡張して通常の変数宣言のように使用できるようにする](extending_structured_bindings_to_be_more_like_variable_declarations.md)」の仕様でそれが可能となったため、この部分は打ち消された。
400-
401-
+## 仕様
402-
+
403-
+odr-usable(=ある名前の定義がその場所で見つかるか)という用語を導入して、lamda式でキャプチャできるものの増加に対して、規格文面の整理が行われた。
404-
+
405-
+ローカル変数のように、ローカルでodr-usedされる時に、その場所ではodr-usableでないとき、そのプログラムは適格ではない。
406-
+
407-
+```cpp
408-
+void f(int n) {
409-
+ [] { n = 1; }; // error: nが使われようとしているのはlambda式の中なので、odr-usableではない
410-
+ struct A {
411-
+ void f() { n = 2; } // error: nが使われようとしているのは関数定義スコープの中なので、odr-usableではない
412-
+ };
413-
+ void g(int = n); // error: nが使われ用としているのはlambda式以外の関数引数スコープの中なので、odr-usableではない
414-
+ [=](int k = n) {}; // error: n is not odr-usable due to being
415-
+ // outside the block scope of the lambda-expression
416-
+ [&amp;amp;] { [n]{ return n; }; }; // OK
417-
+}
418-
+```
419-
420-
## &amp;lt;a id=&amp;#34;relative-page&amp;#34; href=&amp;#34;#relative-page&amp;#34;&amp;gt;関連項目&amp;lt;/a&amp;gt;
421-
- [C++17 構造化束縛](/lang/cpp17/structured_bindings.md)
422-
- [C++20 構造化束縛を拡張して通常の変数宣言のように使用できるようにする](extending_structured_bindings_to_be_more_like_variable_declarations.md)
423-
+- [C++20 構造化束縛した変数の参照キャプチャを許可](reference_capture_of_structured_bindings.md)
424-
425-
## 参照
426-
- [P0588R1 Simplifying implicit lambda capture](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0588r1.html)
427-
&lt;/code&gt;&lt;/pre&gt;</summary>
428-
429-
<author>
430-
<name>yumetodo</name>
431-
<email>yume-wikijp@live.jp</email>
432-
</author>
433-
</entry>
434-
435452
</feed>

sitemap.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51236,7 +51236,7 @@
5123651236

5123751237
<url>
5123851238
<loc>https://cpprefjp.github.io/lang/cpp11/static_assert.html</loc>
51239-
<lastmod>2026-09-15T16:05:27+09:00</lastmod>
51239+
<lastmod>2026-09-15T16:15:49+09:00</lastmod>
5124051240
<changefreq>daily</changefreq>
5124151241
<priority>0.7</priority>
5124251242
</url>
@@ -51530,7 +51530,7 @@
5153051530

5153151531
<url>
5153251532
<loc>https://cpprefjp.github.io/lang/cpp17/if_constexpr.html</loc>
51533-
<lastmod>2026-09-15T16:05:27+09:00</lastmod>
51533+
<lastmod>2026-09-15T16:15:49+09:00</lastmod>
5153451534
<changefreq>daily</changefreq>
5153551535
<priority>0.7</priority>
5153651536
</url>

0 commit comments

Comments
 (0)