Iに定義:C++依存名:この型名は必須ですか? <code>a.hpp</code>で
#include <utility>
namespace Board {
template<int W, int H>
struct GroupNode
{
using PointType = std::pair<int, int>;
// ...
};
}
を次に、b.cpp
でIが定義:
#include "a.hpp"
namespace Board {
template<int W, int H>
struct NodeList
{
using StdList = std::list < /* typename */ GroupNode<W, H>>;
}
}
// and then use NodeList<19, 19> nl;
を上記のコードは警告なしGCC-6と打ち鳴らす-3.9の両方でコンパイルすることができます。 しかし、Clion2016.3はb.cpp
にcannot resolve variable GroupNode
を訴えました。コメントを外すと、typename
はClionの警告を駄目にするかもしれませんが、私はこのtypename
が必要かどうか疑問に思っていましたか?もしそうなら、なぜg ++/clang ++が警告を出さなかったのですか?