You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Clang][Sema] Retain the expanding index for unevaluated type constraints (#109518)
(This continues the effort of #86265, fixing another piece of issue in
constraint evaluation on variadic lambdas.)
We need the depth of the primary template parameters for constraint
substitution. To that end, we avoided substituting type constraints by
copying the constraint expression when instantiating a template. This,
however, has left an issue in that for lambda's parameters, they can
reference outer template packs that would be expanded in the process of
an instantiation, where these parameters would make their way into the
constraint evaluation, wherein we have no other way to expand them later
in evaluation. For example,
template <class... Ts> void foo() {
bar([](C<Ts> auto value) {}...);
}
The lambda references a pack `Ts` that should be expanded when
instantiating `foo()`. The `Ts` along with the constraint expression
would not be transformed until constraint evaluation, and at that point,
we would have no chance to expand `Ts` anyhow.
This patch takes an approach that transforms `Ts` from an unexpanded
TemplateTypeParmType into a SubstTemplateTypeParmType with the current
pack substitution index, such that we could use that to expand the type
during evaluation.
Fixes#101754
Copy file name to clipboardExpand all lines: clang/docs/ReleaseNotes.rst
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -451,6 +451,8 @@ Bug Fixes to C++ Support
451
451
diagnosing a failed cast caused indirectly by a failed implicit conversion to the type of the constructor parameter.
452
452
- Fixed an assertion failure by adjusting integral to boolean vector conversions (#GH108326)
453
453
- Mangle friend function templates with a constraint that depends on a template parameter from an enclosing template as members of the enclosing class. (#GH110247)
454
+
- Fixed an issue in constraint evaluation, where type constraints on the lambda expression
455
+
containing outer unexpanded parameters were not correctly expanded. (#GH101754)
0 commit comments