[llvm-bugs] [Bug 34825] New: Poor diagnostic message for "1" vs "1U" mismatch with std::atomic
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 3 19:04:50 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34825
Bug ID: 34825
Summary: Poor diagnostic message for "1" vs "1U" mismatch with
std::atomic
Product: new-bugs
Version: trunk
Hardware: Macintosh
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: sean at rogue-research.com
CC: llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171004/b82ff0c6/attachment.html>
More information about the llvm-bugs
mailing list