PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers
authorAaron Puchert <aaronpuchert@alice-dsl.net>
Wed, 22 Apr 2020 18:05:36 +0000 (20:05 +0200)
committerAaron Puchert <aaronpuchert@alice-dsl.net>
Wed, 22 Apr 2020 20:37:21 +0000 (22:37 +0200)
commitf43859a099fa3587123717be941fa63ba8d0d4f2
tree895592dbaca002ed6f76754137099917d240eb95
parente5291c4ae3f7272ca3901d1189d30e23fd578193
PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers

Summary:
We extend the behavior for local functions and methods of local classes
to lambdas in variable initializers. The initializer is not a separate
scope, but we treat it as such.

We also remove the (faulty) instantiation of default arguments in
TreeTransform::TransformLambdaExpr, because it doesn't do proper
initialization, and if it did, we would do it twice (and thus also emit
eventual errors twice).

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D76038
clang/include/clang/AST/DeclBase.h
clang/lib/AST/DeclBase.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/vartemplate-lambda.cpp
clang/test/SemaTemplate/instantiate-local-class.cpp