aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C13
3 files changed, 18 insertions, 9 deletions
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C
index 1c25252..e1792e1 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C
@@ -1,9 +1,9 @@
// { dg-do compile { target c++20 } }
template <class T, class U>
-concept Concept2 = requires (T t, U u)
+concept Concept2 = requires (T t, U u) // { dg-error "depends on itself" }
{
- t += u; // { dg-error "template instantiation depth" }
+ t += u;
};
template <class T>
@@ -17,7 +17,5 @@ struct S
constexpr S operator * (S a, S b)
{
- return a += b;
+ return a += b; // { dg-error "no match" }
}
-
-// { dg-prune-output "compilation terminated" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C
index 992fcbb..9bc96f5 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C
@@ -1,7 +1,7 @@
// { dg-do compile { target c++20 } }
template<typename T>
-concept Fooable = requires(T t) { foo(t); }; // { dg-error "template instantiation depth" }
+concept Fooable = requires(T t) { foo(t); }; // { dg-error "depends on itself" }
template<Fooable T>
void foo(T t) { }
@@ -9,7 +9,5 @@ void foo(T t) { }
void test()
{
struct S {} s;
- foo(s);
+ foo(s); // { dg-error "no match" }
}
-
-// { dg-prune-output "compilation terminated" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C
new file mode 100644
index 0000000..18d126e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C
@@ -0,0 +1,13 @@
+// PR c++/96840
+// { dg-do compile { target c++20 } }
+
+template <class T, class U> concept C = requires(T t, U u) { t * u; };
+// { dg-message "required for the satisfaction of 'C<T, Rep>' .with T = Int<int>; Rep = int." "" { target *-*-* } .-1 }
+// { dg-error "depends on itself" "" { target *-*-* } .-2 }
+
+template <class Rep> struct Int {
+ template <class T> requires C<T, Rep> friend void operator*(T, Int) { }
+ template <class T> requires C<T, Rep> friend void operator*(Int, T) { }
+};
+
+void f() { 0 * Int<int>{}; }