Don't instantiate lambda closure types in default member initializers
authorRichard Smith <richard@metafoo.co.uk>
Wed, 21 Oct 2020 00:35:15 +0000 (17:35 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Wed, 21 Oct 2020 00:37:07 +0000 (17:37 -0700)
commit15e772e8dc39f609115430f39078fbe58812fddb
tree6b30e9c87a72bd7836b5e13a2b92a8a1ba334ff2
parentebdcef20ce2921d1b6e8463ecf4031396cef79dc
Don't instantiate lambda closure types in default member initializers
when instantiating the enclosing class.

We'll build new lambda closure types if and when we instantiate the
default member initializer, and instantiating the closure type by itself
can go wrong in cases where we fully-instantiate nested classes (in
explicit instantiations of the enclosing class and when the enclosing
class is a local class) -- we will instantiate the 'operator()' as a
regular function rather than as a lambda call operator, so it doesn't
get to use its captures, has the wrong 'this' type, etc.
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/test/SemaTemplate/explicit-instantiation.cpp
clang/test/SemaTemplate/instantiate-local-class.cpp