[clang] [Clang][test] Re-enable nested generic lambda tests (PR #238805)

Macro Terra via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 06:50:03 PST 2026


https://github.com/hongtaihu created https://github.com/llvm/llvm-project/pull/238805

Re-enable the existing `t2` and `t3` nested generic-lambda tests by removing their `#if 0` guard. Both include a local class member function with a deduced return type; `t3` additionally exercises constraints. All test code and type assertions are unchanged.

Both cases were fixed by eb08c0f1659d12524f58a01bf174177b8acedf2e (#86817), committed on April 2, 2024. Separate native X86 assertions-on bisections identify that commit as the first passing revision for each case; its parent still crashes in `DeduceFunctionTypeFromReturnExpr` with `should have deduced to dependent type`. Moving the dependent return-type adjustment to `CheckFunctionDeclaration` covers the implicitly instantiated `S::f` in these examples, complementing the explicit-specialization declaration tests added by that commit.

Validation: the complete restored file passes its existing C++20 `-fsyntax-only -verify` RUN command twice with assertions enabled at 90fd89ca9155697a1fa4dc2285a4876a8db5ad20. The upstream source at this PR's base matches the tested file before applying this two-line deletion.

Prepared with assistance from Codex.


>From 9d231e29ed5f4e835c0045036b7ae9fec69d3fcf Mon Sep 17 00:00:00 2001
From: hongtaihu <13541229370 at qq.com>
Date: Wed, 4 Nov 2026 22:44:30 +0800
Subject: [PATCH] [Clang][test] Re-enable nested generic lambda tests

Both t2 and t3 were fixed by eb08c0f1659d (#86817), committed on
April 2, 2024. Restore the existing instantiations and type assertions
by removing their disabled guard.

Assisted-by: Codex
---
 clang/test/SemaTemplate/generic-lambda.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/clang/test/SemaTemplate/generic-lambda.cpp b/clang/test/SemaTemplate/generic-lambda.cpp
index 7e7c3419f1b43c..4986de21bd6624 100644
--- a/clang/test/SemaTemplate/generic-lambda.cpp
+++ b/clang/test/SemaTemplate/generic-lambda.cpp
@@ -27,7 +27,6 @@ template <class T1> X<X<X<T1>>> t1() {
 };
 template X<X<X<int>>> t1<int>();
 
-#if 0 // FIXME: crashes
 template<class T1> auto t2() {
   return []<class T2>(T2) {
     struct S {
@@ -59,7 +58,6 @@ template<class T1> C1<X<X<T1>>> auto t3() {
 };
 template C1<X<X<int>>> auto t3<int>();
 static_assert(is_same<decltype(t3<int>()), X<X<X<int>>>>);
-#endif
 
 namespace GH95735 {
 



More information about the cfe-commits mailing list