小编slo*_*ace的帖子

GCC 对 std::invocable 的实现是否不正确或仍然不完整?

我尝试在godbolt上提供的以下代码片段中使用 std::is_invocable 。

#include <type_traits>
 
struct A {
  void operator()(int);
};

struct B {
  void operator()(int, int);
};

struct C : A, B {};

int main()
{
  static_assert(std::is_invocable<A, int>() == true);
  static_assert(std::is_invocable<B, int>() == false);
  static_assert(std::is_invocable<C, int>() == true);
}
Run Code Online (Sandbox Code Playgroud)

Clang 可以解决所有问题,但 GCC 似乎对这一行有问题:

static_assert(std::is_invocable<C, int>() == true);

C 继承了函数调用运算符。

那么GCC的实现是不正确的还是仍在进行中?

c++ language-lawyer c++17

3
推荐指数
1
解决办法
226
查看次数

标签 统计

c++ ×1

c++17 ×1

language-lawyer ×1