模板模板参数的参数是否会引起阴影? [英] Can a parameter of a template template parameter cause shadowing?

查看:82
本文介绍了模板模板参数的参数是否会引起阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是合法的C ++吗?

Is this legal C++?

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

Clang(3.7.1)拒绝它,抱怨第二个 T 阴影第一个 T 。 GCC似乎不在乎它,我认为这是合理的。我认为只有模板模板参数中重要的参数数量。

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.

  • http://goo.gl/51bHVG (gcc.godbolt.org)

推荐答案

否。 [temp.local] / 6

不能在
(包括嵌套作用域)范围内重新声明模板参数

这篇关于模板模板参数的参数是否会引起阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆