]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: the specialization atomic_ref<bool> should use the primary template
authorDamien Lebrun-Grandie <dalg24@gmail.com>
Wed, 22 May 2024 21:43:45 +0000 (17:43 -0400)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 11 Jul 2024 23:08:15 +0000 (00:08 +0100)
Per [atomics.ref.int] `bool` is excluded from the list of integral types
for which there is a specialization of the `atomic_ref` class template
and [Note 1] clearly states that `atomic_ref<bool>` "uses the primary
template" instead.

libstdc++-v3/ChangeLog:

* include/bits/atomic_base.h (__atomic_ref): Do not use integral
specialization for bool.

Signed-off-by: Damien Lebrun-Grandie <dalg24@gmail.com>
libstdc++-v3/include/bits/atomic_base.h

index 20901b7fc06f774860f11c6c8ae8c4444e53003b..1c2367b39b6629de8c3938525807aa341c3604ba 100644 (file)
@@ -1478,7 +1478,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #undef _GLIBCXX20_INIT
 
   template<typename _Tp,
-          bool = is_integral_v<_Tp>, bool = is_floating_point_v<_Tp>>
+           bool = is_integral_v<_Tp> && !is_same_v<_Tp, bool>,
+           bool = is_floating_point_v<_Tp>>
     struct __atomic_ref;
 
   // base class for non-integral, non-floating-point, non-pointer types