Skip to content

Commit 163a79a

Browse files
committed
Apply suggested changes from review
1 parent 145d45a commit 163a79a

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

libcxx/test/std/atomics/types.pass.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ struct has_difference_type : std::false_type {};
3737
template <typename T>
3838
struct has_difference_type<T, myvoid_t<typename T::difference_type> > : std::true_type {};
3939

40-
template <class A, bool IntegralOrFloating, bool Pointer>
40+
template <class T,
41+
bool IntegralOrFloating =
42+
(std::is_integral<T>::value && !std::is_same<T, bool>::value) || std::is_floating_point<T>::value,
43+
bool Pointer = std::is_pointer<T>::value>
4144
struct test_atomic {
4245
test_atomic() {
43-
static_assert(!IntegralOrFloating || !Pointer, "");
46+
static_assert(!IntegralOrFloating && !Pointer, "");
47+
using A = std::atomic<T>;
4448
A a;
4549
(void)a;
4650
#if TEST_STD_VER >= 17
@@ -50,9 +54,10 @@ struct test_atomic {
5054
}
5155
};
5256

53-
template <class A>
54-
struct test_atomic<A, true, false> {
57+
template <class T>
58+
struct test_atomic<T, true, false> {
5559
test_atomic() {
60+
using A = std::atomic<T>;
5661
A a;
5762
(void)a;
5863
#if TEST_STD_VER >= 17
@@ -62,9 +67,10 @@ struct test_atomic<A, true, false> {
6267
}
6368
};
6469

65-
template <class A>
66-
struct test_atomic<A, false, true> {
70+
template <class T>
71+
struct test_atomic<T, false, true> {
6772
test_atomic() {
73+
using A = std::atomic<T>;
6874
A a;
6975
(void)a;
7076
#if TEST_STD_VER >= 17
@@ -80,12 +86,7 @@ void test() {
8086
#if TEST_STD_VER >= 17
8187
static_assert((std::is_same_v<typename A::value_type, T>), "");
8288
#endif
83-
enum {
84-
IntegralOrFloating =
85-
(std::is_integral<T>::value && !std::is_same<T, bool>::value) || std::is_floating_point<T>::value
86-
};
87-
enum { Pointer = std::is_pointer<T>::value };
88-
test_atomic<A, IntegralOrFloating, Pointer>();
89+
test_atomic<T>();
8990
}
9091

9192
struct TriviallyCopyable {

0 commit comments

Comments
 (0)