https://github.com/cor3ntin created 
https://github.com/llvm/llvm-project/pull/197634

Because concepts were checked for satisfaction in the wrong contexts, we ended 
up creating deduction guides in the wrong contexts.

Fixes #197067

>From 9c635fa80b0f20a105c3693a1e02e2bbfd743e75 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <[email protected]>
Date: Thu, 14 May 2026 10:17:07 +0200
Subject: [PATCH] [Clang][NFC] Add a regression test for #197067

Because concepts were checked for satisfaction in the wrong contexts,
we ended up creating deduction guides in the wrong contexts.

Fixes #197067
---
 clang/docs/ReleaseNotes.rst          |  2 +-
 clang/test/SemaTemplate/concepts.cpp | 32 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b49286b35c6b0..3c9baf25c8028 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -576,7 +576,7 @@ Bug Fixes to C++ Support
 - Fixed a crash on error recovery when dealing with invalid templates. 
(#GH183075)
 - Fixed a crash when instantiating ``requires`` expressions involving 
substitution failures in C++ concepts. (#GH176402)
 - Concepts appearing in the require-clause of a member function no longer have 
access to non-public members of that class,
-  or to a current class object. (#GH115838) (#GH194803)
+  or to a current class object. (#GH115838) (#GH194803) (#GH197067)
 - We no longer caches invalid variable specializations. (#GH132592)
 - Fixed an incorrect template argument deduction when matching packs of 
template
   template parameters when one of its parameters is also a pack. (#GH181166)
diff --git a/clang/test/SemaTemplate/concepts.cpp 
b/clang/test/SemaTemplate/concepts.cpp
index 72a2fab99c581..86d6c4483cb73 100644
--- a/clang/test/SemaTemplate/concepts.cpp
+++ b/clang/test/SemaTemplate/concepts.cpp
@@ -1947,3 +1947,35 @@ static_assert(D<Publ>::has, "Public should be visible.");
 static_assert(!D<Priv>::has, "Private should be invisible.");
 static_assert(!D<Prot>::has, "Protected should be invisible.");
 }
+
+
+namespace GH197067 {
+typedef int uint32_t;
+class basic_string;
+using string = basic_string;
+using __self_view = int;
+struct basic_string {
+  basic_string(const char *);
+  operator __self_view();
+};
+int GetVmo(int);
+template <typename> struct StorageTraits;
+template <class Traits, typename Storage>
+concept StorageTraitsBufferedReadApi =
+    requires(Storage storage_ref, uint32_t length) {
+      Traits::Read(storage_ref, length, length, [] {});
+    };
+template <class Traits, typename Storage>
+concept StorageTraitsApi = StorageTraitsBufferedReadApi<Traits, Storage>;
+template <typename T>
+concept StorageApi = StorageTraitsApi<StorageTraits<T>, T>;
+template <StorageApi Storage> struct View {
+  using storage_type = Storage;
+  storage_type storage_;
+};
+template <> struct StorageTraits<int> {
+  template <typename Callback>
+  static auto Read(int, long, uint32_t, Callback) {}
+};
+View zbi(GetVmo(string("")));
+}

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to