[clang] [clang] Fix crash parsing delayed lambda default arguments (PR #213556)

Gauarv Chaudhary via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 09:50:36 PDT 2026


ANAMASGARD wrote:

Hi @zwuis @TPPPP72  thank you so much for the feedback. I have updated the patch.

- My earlier explanation was wrong: the lambda scope was **not** popped.
- During delayed default-arg parsing, a temporary `FunctionScopeInfo` sits on top of `LambdaScopeInfo`.
- The old lookup stopped at that frame and missed the lambda scope → assert/crash.
- **Fix:** skip all non-`LambdaScopeInfo` frames until we find the lambda scope. The assert stays.
- **Result:** `__FUNCTION__` in a lambda-local struct default arg now resolves to the lambda’s `operator()`, like MSVC.
- Added tests in `GH213420.cpp` for the crash and the `__FUNCTION__` case.

Let me know if anything still needs tweaking.

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


More information about the cfe-commits mailing list