[clang] [Sema] LambdaScopeForCallOperatorInstantiationRAII - fix typo in early out logic (PR #96888)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 29 03:45:49 PDT 2024


zyn0217 wrote:

So, here is the offending case:

```cpp
template <class>
concept True = true;

template <class... U>
using MeowMeow = decltype([]<True>(U...) {}.template operator()<char>(U()...));

void foo() {
  using T = MeowMeow<char, int, long, unsigned>;
}
```

In this example, the lambda does not have the `TypeAliasTemplateDecl` where it is defined as its DeclContext - the `TypeAliasTemplateDecl` / `TypeAliasDecl` does not constitute a DeclContext. So, it's owned by TranslationUnitDecl. OTOH, we will instantiate the lambda inside the function `foo()` and thus the DeclContext of the instantiation is `foo()`, hence the discrepancy.

https://github.com/llvm/llvm-project/pull/96888


More information about the cfe-commits mailing list