title: Calling std::atomic_fetch_add, getting ''No matching function for call to 'atomic_fetch_add' error
body: <p>My background is in Swift and Objective-C, so I'm getting confused by this behaviour in a C++ file I'm working on.</p>
  
  <p>First of all, this line:</p>
  
  <pre><code>OSAtomicIncrement32Barrier(&amp;changeCounter);
  </code></pre>
  
  <p>In Xcode it shows the warning:</p>
  
  <blockquote>
    <p>'OSAtomicIncrement32Barrier' is deprecated: first deprecated in iOS 10.0 - Use std::atomic_fetch_add() from &lt;atomic&gt; instead</p>
  </blockquote>
  
  <p>No sweat. I import <code>&lt;atomic&gt;</code> and replace the line with:</p>
  
  <pre><code>std::atomic_fetch_add(&amp;changeCounter, 1);
  </code></pre>
  
  <p>But now I get a full-blown error:</p>
  
  <blockquote>
    <p>No matching function for call to 'atomic_fetch_add'</p>
  </blockquote>
  
  <p><code>changeCounter</code> is defined thus:</p>
  
  <pre><code>volatile int32_t changeCounter = 0;
  </code></pre>
  
  <p>I've also tried it as a <code>volatile int</code>. But no change.</p>
  
  <p>I used code completion to get that function, and as far as I can tell I'm putting the correct arguments in. Documentation I can find (for example, <a href="http://en.cppreference.com/w/cpp/atomic/atomic_fetch_add" rel="nofollow noreferrer">here</a>) shows <code>atomic_fetch_add</code> in use and I appear to be doing it the same way.</p>
  
  <p>Any idea how to fix this problem?</p>