[Clang] Correctly capture bindings in dependent lambdas.
authorCorentin Jabot <corentinjabot@gmail.com>
Wed, 2 Nov 2022 11:54:46 +0000 (12:54 +0100)
committerCorentin Jabot <corentinjabot@gmail.com>
Mon, 9 Jan 2023 20:20:57 +0000 (21:20 +0100)
commite1111e2056e7245b21e24816f6f7ef5ac016ed6f
treef09b3c819baebe4ef7d60452f6c4213092e9a317
parentdc1b614bb8b0181f7443848633807f5fb934c6b2
[Clang] Correctly capture bindings in dependent lambdas.

Structured bindings were not properly marked odr-used
and therefore captured in generic lambddas.

Fixes #57826

It is unclear to me if further simplification can be gained
through the allowance described in
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0588r1.html.

Either way, I think this makes support for P0588 completes,
but we probably want to add test for that in a separate PR.
(and I lack confidence I understand P0588 sufficiently to assert
the completeness of our cnformance).

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D137244
12 files changed:
clang/include/clang/AST/Decl.h
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/include/clang/Sema/SemaLambda.h
clang/lib/AST/DeclCXX.cpp
clang/lib/Sema/ScopeInfo.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/cxx20-decomposition.cpp