1 /* PR c++/71675 - __atomic_compare_exchange_n returns wrong type for typed
2    enum  */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c11" } */
5 
6 
7 #define Test(T)								\
8   do {									\
9     static T x;								\
10     int r [_Generic (__atomic_compare_exchange_n (&x, &x, x, 0, 0, 0),	\
11 		     _Bool: 1, default: -1)];				\
12     (void)&r;								\
13   } while (0)
14 
f(void)15 void f (void)
16 {
17   /* __atomic_compare_exchange_n would fail to return _Bool when
18      its arguments were one of the three character types.  */
19   Test (char);
20   Test (signed char);
21   Test (unsigned char);
22 
23   Test (int);
24   Test (unsigned int);
25 
26   Test (long);
27   Test (unsigned long);
28 
29   Test (long long);
30   Test (unsigned long long);
31 
32   typedef enum E { e } E;
33   Test (E);
34 }
35