[llvm-bugs] [Bug 47908] New: Overloads of atomic_fetch_meow(atomic<T*>*, ...) are non-conforming
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 19 16:13:17 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47908
Bug ID: 47908
Summary: Overloads of atomic_fetch_meow(atomic<T*>*, ...) are
non-conforming
Product: libc++
Version: 11.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: Casey at Carter.net
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
<atomic> includes overloads:
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_add(volatile atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op) _NOEXCEPT
{
return __o->fetch_add(__op);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_add(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type
__op) _NOEXCEPT
{
return __o->fetch_add(__op);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
{
return __o->fetch_add(__op, __m);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_add_explicit(atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
{
return __o->fetch_add(__op, __m);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_sub(volatile atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op) _NOEXCEPT
{
return __o->fetch_sub(__op);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_sub(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type
__op) _NOEXCEPT
{
return __o->fetch_sub(__op);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
{
return __o->fetch_sub(__op, __m);
}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
_Tp*
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, typename
atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
{
return __o->fetch_sub(__op, __m);
}
which don't appear in the Standard. This wouldn't be an issue, except for the
fact that e.g. `atomic_fetch_add<int*>` doesn't name a specialization of the
`atomic_fetch_add` overload that takes `atomic<T*>`, it names a specialization
of the `atomic_fetch_add` overload that takes `atomic<T>` which is
unfortunately constrained to reject argument types that aren't integral and
non-`bool`.
Conforming programs that pass pointer type arguments via explicit template
argument lists to these `atomic_fetch_meow` overloads will fail to compile,
e.g., https://godbolt.org/z/q7b6Yj.
--
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/20201019/0363aa7e/attachment.html>
More information about the llvm-bugs
mailing list