From: Jonathan Wakely Date: Thu, 11 Jul 2024 20:23:15 +0000 (+0100) Subject: libstdc++: Test that std::atomic_ref uses the primary template X-Git-Tag: basepoints/gcc-16~7572 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43763bd75f1d37189ba08657a322e91d240e8cf3;p=thirdparty%2Fgcc.git libstdc++: Test that std::atomic_ref uses the primary template The previous commit changed atomic_ref to not use the integral specialization. This adds a test to verify that change. We can't directly test that the primary template is used, but we can check that the member functions of the integral specializations are not present. libstdc++-v3/ChangeLog: * testsuite/29_atomics/atomic_ref/bool.cc: New test. --- diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/bool.cc b/libstdc++-v3/testsuite/29_atomics/atomic_ref/bool.cc new file mode 100644 index 000000000000..4702932627e8 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/bool.cc @@ -0,0 +1,15 @@ +// { dg-do compile { target c++20 } } + +#include + +template concept has_and = requires (T& a) { a &= false; }; +template concept has_or = requires (T& a) { a |= false; }; +template concept has_xor = requires (T& a) { a ^= false; }; +template concept has_fetch_add = requires (T& a) { a.fetch_add(true); }; +template concept has_fetch_sub = requires (T& a) { a.fetch_sub(true); }; + +static_assert( not has_and> ); +static_assert( not has_or> ); +static_assert( not has_xor> ); +static_assert( not has_fetch_add> ); +static_assert( not has_fetch_sub> );