Clang error : invalid operands to binary expression ('const auto' and 'int')
语境 :
简单的问题:
- 此错误在此上下文中意味着什么?(例如,该消息与此处相关吗?)
- 为什么这个错误只在使用 Clang 编译时出现,而不是 GCC 和 Msvc-cl ?
这是一个最小的复制案例(可用的在上帝螺栓上 https://godbolt.org/z/ofveeGoWe)
template <typename ... Ts>
struct foo
{
constexpr inline static auto value = 42;
};
template <typename ... Ts>
struct bar
{
template <typename U>
constexpr static inline auto foo_value = foo<Ts...>::value; // Error here
// nb : replacing `auto` with `int` remove the error
};
static_assert(bar<int>::foo_value<int> == 42); // K.O : invalid operands to binary expression ('const auto' and 'int')
看起来 Clang 无法评估auto
依赖于另一个类型auto
,当两者都依赖于模板上下文时。
[作者编辑]也许与https://bugs.llvm.org/show_bug.cgi?id=43459 https://bugs.llvm.org/show_bug.cgi?id=43459
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)