Can a parameter of a template template parameter c

2019-02-21 23:20发布

Is this legal C++?

template <typename T, template <typename T> class>
struct S { };

Clang (3.7.1) rejects it, complaining the second T shadows the first T. GCC seems not to care about it and I think that's reasonable. I think it is only the number of parameters that matters in a template template parameter.

1条回答
叼着烟拽天下
2楼-- · 2019-02-21 23:47

No. [temp.local]/6:

A template-parameter shall not be redeclared within its scope (including nested scopes).

查看更多
登录 后发表回答