diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/atomic')
-rw-r--r-- | gcc/testsuite/gcc.dg/atomic/pr71675.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/atomic/pr71675.c b/gcc/testsuite/gcc.dg/atomic/pr71675.c new file mode 100644 index 00000000000..4a1675cf2f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic/pr71675.c @@ -0,0 +1,32 @@ +/* PR c++/71675 - __atomic_compare_exchange_n returns wrong type for typed enum + */ +/* { dg-do compile { target c11 } } */ + +#define Test(T) \ + do { \ + static T x; \ + int r [_Generic (__atomic_compare_exchange_n (&x, &x, x, 0, 0, 0), \ + _Bool: 1, default: -1)]; \ + (void)&r; \ + } while (0) + +void f (void) +{ + /* __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 (int); + Test (unsigned int); + + Test (long); + Test (unsigned long); + + Test (long long); + Test (unsigned long long); + + typedef enum E { e } E; + Test (E); +} |