[clang] [clang] Implement CWG2428 "Deprecating a concept" (PR #92295)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 15 23:20:30 PDT 2024
================
@@ -45,6 +45,38 @@ void fallthrough(int n) {
#endif
}
+namespace cwg2428 { // cwg2428: 19
+#if __cplusplus >= 202002L
+template <typename>
+concept C [[deprecated]] = true; // #cwg2428-C
+
+template <typename>
+[[deprecated]] concept C2 = true;
+// expected-error at -1 {{expected unqualified-id}}
+
+template <typename T>
+concept C3 = C<T>;
+// expected-warning at -1 {{'C' is deprecated}}
+// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}}
+
+template <typename T, C U>
+// expected-warning at -1 {{'C' is deprecated}}
+// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}}
+requires C<T>
+// expected-warning at -1 {{'C' is deprecated}}
+// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}}
+void f() {
+ bool b = C<int>;
+ // expected-warning at -1 {{'C' is deprecated}}
+ // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}}
+};
+
+void g(C auto a) {};
+// expected-warning at -1 {{'C' is deprecated}}
+// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}}
+#endif
+} // namespace cwg2428
+
----------------
cor3ntin wrote:
you are missing
```cpp=
template <C T>
void f() {
C auto foo T();
}
```
https://github.com/llvm/llvm-project/pull/92295
More information about the cfe-commits
mailing list