[all-commits] [llvm/llvm-project] 909249: [Clang][Sema] Use correct DeclContext when checkin...

Krystian Stasiowski via All-commits all-commits at lists.llvm.org
Thu May 28 10:35:51 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9092493752a25c94c7e001695e37ab0073c50f5e
      https://github.com/llvm/llvm-project/commit/9092493752a25c94c7e001695e37ab0073c50f5e
  Author: Krystian Stasiowski <sdkrystian at gmail.com>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M clang/lib/Sema/SemaExprCXX.cpp
    A clang/test/CXX/expr/expr.prim/expr.prim.this/p4.cpp

  Log Message:
  -----------
  [Clang][Sema] Use correct DeclContext when checking 'this' (#163243)

As mentioned in #163089, clang crashes for the following inputs:

```cpp
struct S {
    static void f() {
        auto x = []() -> decltype(this) {};
    }
};
```

```cpp
struct S {
    static void f() {
        auto x = []() noexcept(decltype(this)()) {};
    }
};
```

The crash happens because we currently pass `CurContext` to
`isLambdaCallWithExplicitObjectParameter` in `Sema::CheckCXXThisType`
when we should be passing `DC` (returned from
`getFunctionLevelDeclContext`).

Fixes #163089.



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