https://github.com/eiytoq updated https://github.com/llvm/llvm-project/pull/202221
>From 519402905ba442500e71cd02c0de500473c570fd Mon Sep 17 00:00:00 2001 From: eiytoq <[email protected]> Date: Mon, 8 Jun 2026 02:23:05 +0800 Subject: [PATCH 1/2] fix --- clang/lib/AST/ItaniumMangle.cpp | 5 ++- .../CodeGenCXX/mangle-lambdas-gh181933.cpp | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 clang/test/CodeGenCXX/mangle-lambdas-gh181933.cpp diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 85a01c6f4f727..82d47804268eb 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -1090,7 +1090,7 @@ void CXXNameMangler::mangleNameWithAbiTags( } while (DC->isRequiresExprBody()) - DC = DC->getParent(); + DC = Context.getEffectiveParentContext(DC); if (DC->isTranslationUnit() || isStdNamespace(DC)) { // Check if we have a template. @@ -2205,6 +2205,9 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC, bool NoFunction) { assert(!isa<LinkageSpecDecl>(DC) && "prefix cannot be LinkageSpecDecl"); + while (DC->isRequiresExprBody()) + DC = Context.getEffectiveParentContext(DC); + if (DC->isTranslationUnit()) return; diff --git a/clang/test/CodeGenCXX/mangle-lambdas-gh181933.cpp b/clang/test/CodeGenCXX/mangle-lambdas-gh181933.cpp new file mode 100644 index 0000000000000..6fd913d9534cd --- /dev/null +++ b/clang/test/CodeGenCXX/mangle-lambdas-gh181933.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm -o /dev/null %s + +namespace GH181933 { +template <typename Predicate> +void foo(Predicate pred) { + pred(42); +} + +template <typename Predicate> +auto bar(Predicate pred) { + foo(pred); +} + +template <typename T> +concept Baz = requires(const T& x) { + { + bar([](const auto&) { return true; }) + }; +}; + +static_assert(Baz<int>); +} + +namespace PR { +template <typename Predicate> +void foo(Predicate pred) { + pred(42); +} + +template <typename Predicate> +auto bar(Predicate pred) { + foo(pred); +} + +extern "C++" { +static_assert(requires(const int& x) { + { + bar([](const auto&) { return true; }) + }; +}); +} +} >From 5c165ade898cf41bf387d7c5f4a48943a71b5117 Mon Sep 17 00:00:00 2001 From: eiytoq <[email protected]> Date: Mon, 8 Jun 2026 02:39:30 +0800 Subject: [PATCH 2/2] ci --- clang/lib/AST/ItaniumMangle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 82d47804268eb..08cf61a26e507 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2206,7 +2206,7 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC, bool NoFunction) { assert(!isa<LinkageSpecDecl>(DC) && "prefix cannot be LinkageSpecDecl"); while (DC->isRequiresExprBody()) - DC = Context.getEffectiveParentContext(DC); + DC = Context.getEffectiveParentContext(DC); if (DC->isTranslationUnit()) return; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
