From 11fa2729eff8bc585e33086bb2c595ae8a37d14f Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Fri, 12 May 2023 08:36:37 -0400 Subject: [PATCH] c++: robustify testcase [PR109752] This rewrites the testcase for PR109752 to make it simpler and more robust (i.e. no longer dependent on r13-4035-gc41bbfcaf9d6ef). PR c++/109752 gcc/testsuite/ChangeLog: * g++.dg/cpp2a/concepts-pr109752.C: Rename to ... * g++.dg/cpp2a/concepts-complete4.C: ... this. Rewrite. --- .../g++.dg/cpp2a/concepts-complete4.C | 13 ++++++++++ .../g++.dg/cpp2a/concepts-pr109752.C | 26 ------------------- 2 files changed, 13 insertions(+), 26 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-complete4.C delete mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-pr109752.C diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-complete4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-complete4.C new file mode 100644 index 000000000000..988b0ddcfdd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-complete4.C @@ -0,0 +1,13 @@ +// PR c++/109752 +// { dg-do compile { target c++20 } } + +template +concept C = requires { sizeof(T); } && T::value; // { dg-error "changed from" } + +struct A; + +static_assert(!C); + +struct A { static constexpr bool value = false; }; + +static_assert(C); // { dg-error "assert" } diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr109752.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr109752.C deleted file mode 100644 index d54ce295e50a..000000000000 --- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr109752.C +++ /dev/null @@ -1,26 +0,0 @@ -// PR c++/109752 -// { dg-do compile { target c++20 } } - -template - inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); - template - concept __weakly_eq_cmp_with - = requires(_Tp __t, _Up __u) { { __u != __t } ; // { dg-error "changed from" } - }; - template - concept regular = is_constructible_v<_Tp> && __weakly_eq_cmp_with<_Tp, _Tp>; - template concept incrementable = true -&& regular<_Iter> -&& requires(_Iter __i) { { __i++ } ;} -; -template -struct iterator_interface -{ - friend constexpr bool operator>=(D lhs, D rhs) requires __weakly_eq_cmp_with { return true; } -}; -template -struct iterator : iterator_interface> -{ - bool operator==(iterator) const; -}; -static_assert(incrementable>); // { dg-error "assert" } -- 2.47.2