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

[FEA]: Add clang-tidy option to prevent capturing variables in lambdas when using coroutines #1582

Open
2 tasks done
cwharris opened this issue Mar 26, 2024 · 0 comments
Open
2 tasks done
Labels
feature request New feature or request

Comments

@cwharris
Copy link
Contributor

cwharris commented Mar 26, 2024

Is this a new feature, an improvement, or a change to existing functionality?

Improvement

How would you describe the priority of this feature request

Medium

Please provide a clear description of problem this feature solves

C++ Lambdas and Coroutines don't play well together. Capturing a value in a coroutine lambda introduces undefined behaviour where the capture may be lost prior to usage. Enabling cppcoreguidelines-avoid-capturing-lambda-coroutines as an error will prevent us from writing code that suffers this problem.

https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-capturing-lambda-coroutines.html

Describe your ideal solution

Enable cppcoreguidelines-avoid-capturing-lambda-coroutines in clang-tidy.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I have searched the open feature requests and have found no duplicates for this feature request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant