This patch fixes an infinite recursion issue when computing the linkage-visibility of nested lambdas in NSDMIs.
Allows compilation of this:
template<class T>
struct L { T t{}; T t2 = ([](int a) { return [](int b) { return b; };})(t)(t); }; L<int> l;
}
Doug had glanced at this change in Chicago as part of my larger generic lambda patch - he thought it would be better addressed and reviewed as a separate patch (since the bug occurs with non-generic lambdas too).
Thanks!
We're not actually testing the linkage here. Please provide a test that generates IR and uses FileCheck to make sure the lambda gets the appropriate LLVM linkage.