【发布时间】:2016-11-23 05:26:29
【问题描述】:
在a.hpp我定义:
#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 和 clang-3.9 上编译而没有任何警告。
然而,Clion 2016.3 在b.cpp 中抱怨cannot resolve variable GroupNode。取消注释 typename 可以驯服 Clion 警告,但我想知道这 typename 是否是必需的?如果是这样,为什么 g++/clang++ 没有发出任何警告?
【问题讨论】:
标签: c++ templates language-lawyer dependent-name