eclipse CDT显示lambda表达式无效的参数'Candidates are:...'

问题描述

面向C / C ++开发人员的Eclipse IDE(包括孵化组件)
版本:2020-06(4.16.0)
版本号:20200615-1200

C / C ++开发工具
版本:9.11.1.202006011430
内部版本号:20200601-1605

带有gcc 10.2.0的Arch Linux

给出以下最小示例

#include <cstdint>
#include <functional>

struct LinkedElement {
    uint8_t index = 0;
    LinkedElement* next = nullptr;
};

static LinkedElement* linkedList;

LinkedElement* FindLinkedElement(std::function<bool(LinkedElement*)> filter)
{
    for (auto elem = linkedList; elem != nullptr; elem = elem->next)
    {
        if (filter(elem))
        {
            return elem;
        }
    }
    return nullptr;
}

int main(int argc,char **argv) {
    auto broken = FindLinkedElement([](LinkedElement* le){ return le->index > 0; });
    auto works = FindLinkedElement(nullptr);
}

eclipse将FindLinkedElement中的第一个main()下划线为“语义错误”(由“问题”视图确定),并显示以下错误消息

Invalid arguments '
Candidates are:
LinkedElement * FindLinkedElement(std::function<bool (LinkedElement *)>)
'

第二行未标记为错误。编译器完全可以使用所有这些代码。我该如何使月食不将其视为错误?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)