【发布时间】:2020-11-29 10:26:07
【问题描述】:
考虑以下两个简单的概念:
template <typename T>
concept C1 = requires(T t) {
[t = t]{ t; };
};
template <typename T>
concept C2 = requires(T t) {
[t]{ t; };
};
在我看来,这两个声明应该是等价的,但是 GCC 拒绝了 concept C2 并说:
<source>:10:9: error: use of parameter outside function body before ';' token
Why GCC only accepts the concept C1,或者这只是一个错误?如果不是,这两个声明有什么区别?
【问题讨论】:
标签: c++ lambda language-lawyer c++20 c++-concepts