Gus*_*uss 5 c++ clang clang++ c++17 c++20
Clang error : invalid operands to binary expression ('const auto' and 'int')
Run Code Online (Sandbox Code Playgroud)
语境 :
简单的问题:
这是一个最小的复制案例(可在 Godbolt 上获得)
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')
Run Code Online (Sandbox Code Playgroud)
看起来 Clang 无法评估auto
依赖于另一个的类型auto
当两者都依赖于模板上下文时。
归档时间: |
|
查看次数: |
73 次 |
最近记录: |