aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/atomic-3.C
blob: 89ca7188aaad56f580e1f7c20098f095a8552b55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// PR c++/71675 - __atomic_compare_exchange_n returns wrong type for typed enum
// { dg-do compile { target c++11 } }

template <class T>
void sink (T);

bool sink (bool);

template <class T>
bool test ()
{
  enum class E: T { };
  static E e;

  return sink (__atomic_compare_exchange_n (&e, &e, e, false, 0, 0));
}

void tests ()
{
  // __atomic_compare_exchange_n would fail to return bool when
  //   its arguments were one of the three character types.
  test<char>();
  test<signed char>();
  test<unsigned char>();

  test<short>();
  test<unsigned short>();

  test<int>();
  test<unsigned int>();

  test<long>();
  test<unsigned long>();

  test<long long>();
  test<unsigned long long>();
}