5
在a.hpp
我定义:C++依赖名称:是否需要此类型名称?
#include <utility>
namespace Board {
template<int W, int H>
struct GroupNode
{
using PointType = std::pair<int, int>;
// ...
};
}
然后,在b.cpp
我定义:
#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没有任何警告进行编译。 但是,Clion 2016.3在b.cpp
中抱怨cannot resolve variable GroupNode
。取消注释typename
可能会驯服Clion警告,但我想知道是否需要此typename
?如果是这样,为什么g ++/clang ++没有发出任何警告?