这是合法的 C++ 吗?
template <typename T, template <typename T> class>
struct S { };
Clang (3.7.1) 拒绝它,提示第二个 T
隐藏了第一个 T
。 GCC 似乎并不关心它,我认为这是合理的。我认为在模板模板参数中重要的只是参数的数量。
- http://goo.gl/51bHVG (gcc.godbolt.org)
最佳答案
没有。 [temp.local]/6 :
A template-parameter shall not be redeclared within its scope (including nested scopes).
关于c++ - 模板模板参数的参数会导致阴影吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35744299/