-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C++17インライン変数 : 名前のないクラスオブジェクトをインライン指定しても同じ実体にはならないことを記載
- Loading branch information
1 parent
192dae6
commit e68299b
Showing
1 changed file
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,10 @@ function-specifier: | |
explicit | ||
``` | ||
|
||
## 備考 | ||
- 名前のないクラスのオブジェクトは、インライン指定しても同じ実体にはならない | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
k-satoda
Contributor
|
||
|
||
|
||
## 例 | ||
|
||
```cpp example | ||
|
@@ -264,3 +268,4 @@ func | |
- [P0386R2 - Inline Variables](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0386r2.pdf), 2016-06-24 | ||
- [P0607R0 - Inline Variables for the Standard Library](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0607r0.html), 2017-02-27 | ||
- [C++1z インライン変数 - Faith and Brave - C++で遊ぼう](https://faithandbrave.hateblo.jp/entry/2016/11/11/172954) | ||
- [インライン変数が翻訳単位毎に別々の実体となってしまう - Stackoverflow](https://ja.stackoverflow.com/questions/93046/) |
@faithandbrave (@yohhoy) リンク先のコード見ましたが、この場合は
extern struct {} x;
を2つ並べて書いた場合と同様の型の不一致(同じ字面でも別々の型による宣言)がコンパイル単位を跨いで発生している状態となって、
エラーにならなかった場合の動作は未定義となりそうです。
https://timsong-cpp.github.io/cppwp/n4861/basic.link#11