Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Syntax Errors Indicated for Valid Lambda
Syntax Errors Indicated for Valid Lambda [message #1848499] Sun, 05 December 2021 20:04
Rud Merriam is currently offline Rud MerriamFriend
Messages: 2
Registered: December 2020
Junior Member
Eclipse CDT 2021-09 (4.21.0)
Ubuntu 20.04
gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04)

The following code compiles and runs fine. But the lambda decode_enum4 is underlined with "syntax errors" in the editor. Not a big problem with this single lambda but have others that show the same underlining. Also have some syntax error underlinings with other code and not properly formatting.

Suggestions on settings to change or is this just a lag in handling this type of code?

#include <iostream>
#include <string>

using RvrMsg = std::basic_string<uint8_t>;

template <typename E>
concept IsEnum = std::is_enum_v<E>;

// all underlined
auto decode_enum4 =
    []<typename E, typename = IsEnum>(RvrMsg const& msg, E& value) {
    value = (E)msg[0];

int main() {
    RvrMsg msg{0x01};

    enum O : uint8_t { one = 1 };

    O o_value;

    decode_enum4(msg, o_value);
    std::cout << (uint16_t)o_value << '\n';

    return 0;

Other code that is underlined with syntax errors or does not format properly:

// illustrative since won't compile without a ton more code
    template <typename ... Ts>
    struct conv_overload : Ts... {
        using Ts::operator( )...;  // underlined

    // all of this template function is underlined 
    // also doesn't auto format properly
    // Deduction guide, google `CTAD for aggregates` for more info
    template <class... Ts>
    conv_overload(Ts...) -> conv_overload<Ts...>;// not needed before C++20

// code to use bunch of lambdas in overload and applied by:

            std::apply([&](auto& ... value) {
                convert(msg, value), ...);   // underlined
            return mTup;

Previous Topic:I can't launch my eclipse
Next Topic:New Breakpoint causes SIGINT to process under debug
Goto Forum:

Current Time: Mon Dec 05 21:40:23 GMT 2022

Powered by FUDForum. Page generated in 0.02655 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top