llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Corentin Jabot (cor3ntin)

<details>
<summary>Changes</summary>

Fixes #<!-- -->206336

---
Full diff: https://github.com/llvm/llvm-project/pull/208465.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaTemplate.cpp (+1) 
- (modified) clang/test/SemaTemplate/concepts.cpp (+16) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 1591cea9286ae..d2e22b0e63146 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -9306,6 +9306,7 @@ bool Sema::CheckConceptUseInDefinition(NamedDecl 
*Concept, SourceLocation Loc) {
       CE && !CE->isInvalidDecl() && !CE->hasDefinition()) {
     Diag(Loc, diag::err_recursive_concept) << CE;
     Diag(CE->getLocation(), diag::note_declared_at);
+    CE->setInvalidDecl();
     return true;
   }
   // Concept template parameters don't have a definition and can't
diff --git a/clang/test/SemaTemplate/concepts.cpp 
b/clang/test/SemaTemplate/concepts.cpp
index 6f7f00bf12e61..f690768476e7c 100644
--- a/clang/test/SemaTemplate/concepts.cpp
+++ b/clang/test/SemaTemplate/concepts.cpp
@@ -2064,3 +2064,19 @@ auto x = quantity<reference<int>{}, int>{};
 } // namespace CannotResolve1
 
 } // namespace GH175831
+
+
+namespace GH206336 {
+class Dim;
+struct S;
+template <class T> concept foo = true;
+template <class T> concept SS = false; // expected-note {{because 'false' 
evaluated to false}}
+template <class X> concept _Dim = _Dim<X>; // expected-error {{a concept 
definition cannot refer to itself}} \
+                                           // expected-note {{declared here}}
+template <SS, _Dim Dim, foo<> E> auto bar(Dim, E) {}; // expected-note 
{{candidate template ignored: constraints not satisfied}} \
+                                                      // expected-note 
{{because 'GH206336::S' does not satisfy 'SS'}}
+
+void baz() {
+  auto qux = bar<S>(true, [] {}); // expected-error {{no matching function for 
call to 'bar'}}
+}
+}

``````````

</details>


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

Reply via email to