[llvm-branch-commits] [clang] [Clang] use `SubstConstraintExpr` instead of `SubstExpr` in `Sema::BuildExprRequirement` (PR #236385)
Mishmish Dev via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Oct 28 04:39:52 PDT 2026
https://github.com/mishmish-dev created https://github.com/llvm/llvm-project/pull/236385
Backport of fb5c64f0cfc12448c72dc86d597e7d2911fb5718 (pull request #236286)
>From 55d3c15838531aed889b72a591fb2a761816cd6f Mon Sep 17 00:00:00 2001
From: Mishmish Dev <31835620+mishmish-dev at users.noreply.github.com>
Date: Wed, 28 Oct 2026 06:23:17 +0000
Subject: [PATCH] [Clang] use `SubstConstraintExpr` instead of `SubstExpr` in
`Sema::BuildExprRequirement` (#236286)
---
clang/lib/Sema/SemaExprCXX.cpp | 2 +-
clang/test/SemaTemplate/concepts-lambda.cpp | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 538604aa2e64bd..7f6e0f54d4e055 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -8011,7 +8011,7 @@ Sema::BuildExprRequirement(
assert(IDC && "ImmediatelyDeclaredConstraint can't be null here.");
SFINAETrap Trap(*this);
- ExprResult Constraint = SubstExpr(IDC, MLTAL);
+ ExprResult Constraint = SubstConstraintExpr(IDC, MLTAL);
bool HasError = Constraint.isInvalid();
if (!HasError) {
SubstitutedConstraintExpr =
diff --git a/clang/test/SemaTemplate/concepts-lambda.cpp b/clang/test/SemaTemplate/concepts-lambda.cpp
index 2010a028fce4a3..039586cb8042ea 100644
--- a/clang/test/SemaTemplate/concepts-lambda.cpp
+++ b/clang/test/SemaTemplate/concepts-lambda.cpp
@@ -206,6 +206,21 @@ void foo() {
}
} // namespace ReturnTypeRequirementInLambda
+namespace GH236286 {
+template <class T, class U>
+concept DecaysTo = __is_same(__decay(T), U);
+
+template <class T, auto Constraint>
+concept Satisfies = requires { Constraint.template operator()<T>(); };
+
+static_assert(requires(int i) {
+ { i } -> Satisfies<[]<DecaysTo<int>> {}>;
+});
+static_assert(!requires(int i) {
+ { i } -> Satisfies<[]<DecaysTo<double>> {}>;
+});
+} // namespace GH236286
+
namespace GH73418 {
void foo() {
int x;
More information about the llvm-branch-commits
mailing list