<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Poor diagnostic message for "1" vs "1U" mismatch with std::atomic"
   href="https://bugs.llvm.org/show_bug.cgi?id=34825">34825</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Poor diagnostic message for "1" vs "1U" mismatch with std::atomic
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sean@rogue-research.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With:  clang version 6.0.0 (trunk 314864) (llvm/trunk 314863)

clang -fsyntax-only test.cxx

--test.cxx---------------------------------
#include <atomic>

int main ()
{
  std::atomic<unsigned int> num(0);
  unsigned int old = std::atomic_fetch_sub(&num, 1);

  return 0;
}
-------------------------------------------

A human programmer would explain: "You have to put 1U, not 1", but clang barfs
all this:


test.cxx:6:22: error: no matching function for call to 'atomic_fetch_sub'
  unsigned int old = std::atomic_fetch_sub(&number, 1);
                     ^~~~~~~~~~~~~~~~~~~~~
/Users/sean/llvm/llvm-rel-install/include/c++/v1/atomic:1486:1: note: candidate
template ignored: could not match 'atomic<type-parameter-0-0>' against
'unsigned int'
atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
^
/Users/sean/llvm/llvm-rel-install/include/c++/v1/atomic:1498:1: note: candidate
template ignored: could not match 'atomic<type-parameter-0-0>' against
'unsigned int'
atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
^
/Users/sean/llvm/llvm-rel-install/include/c++/v1/atomic:1506:1: note: candidate
template ignored: could not match 'atomic<type-parameter-0-0 *>' against
'unsigned int'
atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
^
/Users/sean/llvm/llvm-rel-install/include/c++/v1/atomic:1514:1: note: candidate
template ignored: could not match 'atomic<type-parameter-0-0 *>' against
'unsigned int'
atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
^
1 error generated.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>