cf_arith_mem_ptr.cpp 483 B

12345678910111213141516171819202122
  1. // Copyright (c) 2017 Andrey Semashev
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/atomic.hpp>
  7. struct foo
  8. {
  9. int n;
  10. };
  11. int main(int, char *[])
  12. {
  13. // The test verifies that atomic<> does not provide arithmetic operations on member pointers
  14. typedef int (foo::*mem_ptr);
  15. boost::atomic< mem_ptr > a;
  16. a.fetch_add(1);
  17. return 1;
  18. }