xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/atomics.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // PR8345
f(T * value)5*f4a2713aSLionel Sambuc template<typename T> T f(T* value) {
6*f4a2713aSLionel Sambuc   return __sync_add_and_fetch(value, 1);
7*f4a2713aSLionel Sambuc }
g(long long * x)8*f4a2713aSLionel Sambuc int g(long long* x) { return f(x); }
g(int * x)9*f4a2713aSLionel Sambuc int g(int* x) { return f(x); }
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc namespace PR11320 {
12*f4a2713aSLionel Sambuc   template<typename T>
g(unsigned * x)13*f4a2713aSLionel Sambuc   void g(unsigned *x) {
14*f4a2713aSLionel Sambuc     __sync_bool_compare_and_swap(x, 1, 4);
15*f4a2713aSLionel Sambuc   }
h()16*f4a2713aSLionel Sambuc   void h() { g<int>(0); }
17*f4a2713aSLionel Sambuc }
18