PR42104: Support instantiations of lambdas that implicitly capture
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 4 Jun 2019 17:17:20 +0000 (17:17 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 4 Jun 2019 17:17:20 +0000 (17:17 +0000)
commit7bf8f6fa8ab123fe97ccd82d9a0ddff85505ee5f
treec5eb10d1d4e1f82ebd3925ca1bde79d1145d73e3
parentf4302ad35e340f01529bf32919410b2577f899bd
PR42104: Support instantiations of lambdas that implicitly capture
packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.

This reinstates r362358 (reverted in r362375) with a fix for an
uninitialized variable use in UpdateMarkingForLValueToRValue.

llvm-svn: 362531
clang/include/clang/Sema/ScopeInfo.h
clang/include/clang/Sema/Sema.h
clang/lib/Sema/ScopeInfo.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp
clang/test/SemaTemplate/lambda-capture-pack.cpp [new file with mode: 0644]