File tree 3 files changed +29
-2
lines changed
3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -1054,6 +1054,11 @@ Bug Fixes to C++ Support
1054
1054
Fixes (`#78830 <https://github.com/llvm/llvm-project/issues/78830 >`_)
1055
1055
Fixes (`#60085 <https://github.com/llvm/llvm-project/issues/60085 >`_)
1056
1056
1057
+
1058
+ - Fixed a bug where variables referenced by requires-clauses inside
1059
+ nested generic lambdas were not properly injected into the constraint scope.
1060
+ (`#73418 <https://github.com/llvm/llvm-project/issues/73418 >`_)
1061
+
1057
1062
- Fix incorrect code generation caused by the object argument of ``static operator() `` and ``static operator[] `` calls not being evaluated.
1058
1063
Fixes (`#67976 <https://github.com/llvm/llvm-project/issues/67976 >`_)
1059
1064
Original file line number Diff line number Diff line change @@ -612,8 +612,12 @@ bool Sema::SetupConstraintScope(
612
612
613
613
// If this is a member function, make sure we get the parameters that
614
614
// reference the original primary template.
615
- if (const auto *FromMemTempl =
616
- PrimaryTemplate->getInstantiatedFromMemberTemplate ()) {
615
+ // We walk up the instantiated template chain so that nested lambdas get
616
+ // handled properly.
617
+ for (FunctionTemplateDecl *FromMemTempl =
618
+ PrimaryTemplate->getInstantiatedFromMemberTemplate ();
619
+ FromMemTempl;
620
+ FromMemTempl = FromMemTempl->getInstantiatedFromMemberTemplate ()) {
617
621
if (addInstantiatedParametersToScope (FD, FromMemTempl->getTemplatedDecl (),
618
622
Scope, MLTAL))
619
623
return true ;
Original file line number Diff line number Diff line change @@ -149,3 +149,21 @@ void foo() {
149
149
auto caller = make_caller.operator ()<&S1::f1>();
150
150
}
151
151
} // namespace ReturnTypeRequirementInLambda
152
+
153
+ namespace GH73418 {
154
+ void foo () {
155
+ int x;
156
+ [&x](auto ) {
157
+ return [](auto y) {
158
+ return [](auto obj, auto ... params)
159
+ requires requires {
160
+ sizeof ...(params);
161
+ [](auto ... pack) {
162
+ return sizeof ...(pack);
163
+ }(params...);
164
+ }
165
+ { return false ; }(y);
166
+ }(x);
167
+ }(x);
168
+ }
169
+ } // namespace GH73418
You can’t perform that action at this time.
0 commit comments