xref: /llvm-project/clang/test/SemaCXX/atomic-ops.cpp (revision 6b737c444617fe8c11eb48f978c579cc160bfff0)
1 // RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu -std=c++11
2 
3 // We crashed when we couldn't properly convert the first arg of __atomic_* to
4 // an lvalue.
PR28623()5 void PR28623() {
6   void helper(int); // expected-note{{target}}
7   void helper(char); // expected-note{{target}}
8   __atomic_store_n(helper, 0, 0); // expected-error{{reference to overloaded function could not be resolved}}
9 }
10 
11 template<typename>
12 struct X {
13   char arr[1];
14 };
15 
16 extern X<void>* p, *q;
17 
18 // They should be accepted.
f()19 void f() {
20   __atomic_exchange(p, p, q, __ATOMIC_RELAXED);
21   __atomic_load(p, p, __ATOMIC_RELAXED);
22   __atomic_store(p, p, __ATOMIC_RELAXED);
23   __atomic_compare_exchange(p, p, q, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
24 }
25