Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer warns about an uninitialized value on a structured binding captured in a lambda #115137

Open
KitsuneRal opened this issue Nov 6, 2024 · 0 comments

Comments

@KitsuneRal
Copy link

In C++17, structured bindings could not be immediately captured in lambdas; in C++20 they can but Clang analyzer didn't seem to catch up with this. This small program:

#include <tuple>
#include <iostream>

int main()
{
    std::tuple<std::size_t> t{ 1 };
    auto&& [a] = t;
    [a] {
        std::cout << a << std::endl;
    }();
}

triggers an uninitialised value warning inside the lambda, as can be seen at https://godbolt.org/z/sPsW4Pnr4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant