[all-commits] [llvm/llvm-project] f0c750: [Clang] Fix the order of addInstantiatedParameters...

Yupei Liu via All-commits all-commits at lists.llvm.org
Tue Jul 9 01:40:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0c7505f597998c84023ccd609ecfc9af3d5b4d6
      https://github.com/llvm/llvm-project/commit/f0c7505f597998c84023ccd609ecfc9af3d5b4d6
  Author: Yupei Liu <liuyupei951018 at hotmail.com>
  Date:   2024-07-09 (Tue, 09 Jul 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaLambda.cpp
    M clang/test/SemaTemplate/concepts-lambda.cpp

  Log Message:
  -----------
  [Clang] Fix the order of addInstantiatedParameters in LambdaScopeForCallOperatorInstantiationRAII (#97215)

Currently, `addInstantiatedParameters` is called from the innermost
lambda outward. However, when the function parameters of an inner lambda
depend on the function parameters of an outer lambda, it can lead to a
crash due to the inability to find a mapping for the instantiated decl.

This PR corrects this behavior by calling `addInstantiatedParameters`
from the outside in.

repro code: https://godbolt.org/z/KbsxWesW6

```cpp
namespace dependent_param_concept {
template <typename... Ts> void sink(Ts...) {}
void dependent_param() {
  auto L = [](auto... x) {
    return [](decltype(x)... y) { // `y` depends on `x`
      return [](int z)
        requires requires { sink(y..., z); }
      {};
    };
  };
  L(0, 1)(1, 2)(1);
}
} // namespace dependent_param_concept
```

This PR is a prerequisite for implmenting #61426



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list