Пример, воспроизводящий проблему в Godbolt:
Код: Выделить всё
#include
#include
#include
template
class TaskType {
};
class SomeSafeClassA {};
class SomeSafeClassB {};
template
concept IsSafeClassA = std::is_base_of_v;
template
concept IsSafeClassB = std::is_base_of_v;
namespace std {
template
struct coroutine_traits{
using promise_type = TaskType;
};
template
struct coroutine_traits{
using promise_type = TaskType;
};
template
struct coroutine_traits{
using promise_type = TaskType;
};
}
int main()
{
auto k = []() -> TaskType {
co_return 6;
};
}
Код: Выделить всё
.../type_traits:3514:60: error: incomplete type 'const (lambda at :38:14)' used in type trait expression
3514 | inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
| ^
:13:29: note: in instantiation of variable template specialization 'std::is_base_of_v' requested here
13 | concept IsSafeClassA = std::is_base_of_v;
Код: Выделить всё
template
struct coroutine_traits{
using promise_type = TaskType;
};
Как я могу определить специализации coroutine_traits на основе классов, чтобы лямбда-выражения не вызывали ошибок компилятора?
Подробнее здесь: https://stackoverflow.com/questions/792 ... ng-lambdas
Мобильная версия