C++相談室 part122 [無断転載禁止]©5ch.io
■ このスレッドは過去ログ倉庫に格納されています
0820デフォルトの名無しさん
2016/02/14(日) 07:43:32.58ID:Ssn6bioA規格は>806の通りで最初からこの仕様はある
C++98『The member shall still be defined in a namespace scope if it is used in the program and the namespace scope definition』
この時点でif it is usedが何を意味するのか説明が漏れていて(次の段落を読むと意図は想像できたが)、
C++11『if it is odr-used (3.2) in the program and the namespace scope definition』
と「odr-used」と言う言葉が導入された。これがリンカーの仕事が必要となるような使い方を意味する。
N4567では3.2のサンプルコードでstatic const int変数を
const int &f(const int &r);
に渡してodr-used here, so a definition is requiredとコメントが書かれている
■ このスレッドは過去ログ倉庫に格納されています