C++ 模板参数数量错误(3,应至少为1)

C++ 模板参数数量错误(3,应至少为1),c++,variadic-templates,C++,Variadic Templates,这个错误消息让我困惑,因为上次我检查时,3至少是1 template<class T, long... i> struct S {}; template<class... T> long xor_fold(T&&... flags) { return (flags ^ ... ^ 0); } template<long... lhs, bool dummy, long... rhs> concept test = xor_fold

这个错误消息让我困惑,因为上次我检查时,3至少是1

template<class T, long... i>
struct S
{};

template<class... T>
long xor_fold(T&&... flags)
{
    return (flags ^ ... ^ 0);
}


template<long... lhs, bool dummy, long... rhs>
concept test = xor_fold(lhs...) == xor_fold(rhs...);

template<long... lhs, class L, long... rhs, class R>
requires test<lhs..., false, rhs...>
        bool operator+(S<L, lhs...>, S<R, rhs...>){return true;}

int main()
{
    return 1;
}
模板
结构
{};
模板
长异或折叠(T&&…标志)
{
返回(标志^…^0);
}
模板
概念测试=xor_折叠(lhs…)==xor_折叠(rhs…);
模板
需要测试
布尔运算符+(S,S){返回真;}
int main()
{
返回1;
}
错误:模板参数数量错误(3,应至少为1) 132 |需要测试 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 注:为“模板概念测试”提供 129 |概念测试=f(左舷…==f(右舷…); | ^~~~ 重载运算符只有在两个操作数满足概念中指定的要求时才有效

根据要求,我的编译器版本为:

g++--版本
g++(第3版,由MSYS2项目构建)10.1.0


由于主要问题似乎是一个令人困惑的错误消息,您应该包括编译器版本。实际上,clangs响应也不是很有帮助:“模板参数的数量错误(3,应该至少为1)”@maximust_prime_已更新。我将
static_断言(3>=1)只是为了确定:P
error: wrong number of template arguments (3, should be at least 1)  
  132 | requires test  
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
note: provided for 'template concept test'
  129 | concept test = f(lhs...) == f(rhs...);
      |         ^~~~