Skip to content
Commit edbea62f authored by Jens Massberg's avatar Jens Massberg
Browse files

[clang] Correctly handle by-reference capture with an initializer that is a...

[clang] Correctly handle by-reference capture with an initializer that is a pack expansion in lambdas.

Ensure that the correct information whether an init-capture of a lambda
is passed by reference or by copy. This information is already computed
and has to be passed to the place where `NewInitCaptureType` is
created.

Before this fix it has been checked whether the VarDecl is a reference
type. This doesn't work for packed expansions, as the information
whether it is passed by reference or by copy is stored at the pattern of
a `PackExpansionType` and not at the type itself.

However, as the information has been already computed, we just have to
pass it.

Add tests that lambda captures with var decls which are reference types
are created in the AST and a disgnotics test for pack expansions.

Fixes #49266

Differential Revision: https://reviews.llvm.org/D139125
parent 7203a861
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment