atomics.cpp 376 B

1234567891011121314151617
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. // PR8345
  4. template<typename T> T f(T* value) {
  5. return __sync_add_and_fetch(value, 1);
  6. }
  7. int g(long long* x) { return f(x); }
  8. int g(int* x) { return f(x); }
  9. namespace PR11320 {
  10. template<typename T>
  11. void g(unsigned *x) {
  12. __sync_bool_compare_and_swap(x, 1, 4);
  13. }
  14. void h() { g<int>(0); }
  15. }