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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

<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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to