Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2022 20:41:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 264877] clang-14 fails with unreasonable cryptic message on a valid C++ code
Message-ID:  <bug-264877-29464-S3DMD5fPNW@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-264877-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-264877-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264877

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emaste@freebsd.org

--- Comment #2 from Dimitry Andric <dim@FreeBSD.org> ---
I'm inclined to say "you're holding it wrong" here, but this discussion sho=
uld
really be taken upstream.

Previously, when only including <stdexcept>, you were just lucky that the s=
wap
definition was pulled in transitively via <type_traits> (and that was also
completely by accident), and it seemed to sort-of work.

At some point upstream committed
https://github.com/llvm/llvm-project/commit/6adbc83ee9e46b476e0f75d5671c3a2=
1f675a936:

commit 6adbc83ee9e46b476e0f75d5671c3a21f675a936
Author: Christopher Di Bella <cjdb@google.com>
Date:   Sat Jun 5 02:47:47 2021 +0000

    [libcxx][modularisation] moves <utility> content out of <type_traits>

    Moves:

    * `std::move`, `std::forward`, `std::declval`, and `std::swap` into
      `__utility/${FUNCTION_NAME}`.
    * `std::swap_ranges` and `std::iter_swap` into
      `__algorithm/${FUNCTION_NAME}`

    Differential Revision: https://reviews.llvm.org/D103734

This moved stuff that should really be in <utility>, such as swap() into mo=
re
modular headers, and it had the side effect of only leaving a partial swap
declaration in <type_traits> that is explicitly *not* exposed (via the
_LIBCPP_INLINE_VISIBILITY macro):

template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp>
swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::val=
ue
&&
                                    is_nothrow_move_assignable<_Tp>::value);

I am unsure why this declaration has been left in, though. If I simply comm=
ent
it out, the compile error for your test case at least becomes a lot clearer:

bug264877/test.cpp:9:7: error: no member named 'swap' in namespace 'std'
        std::swap(X1, X2);
        ~~~~~^

However, the decltype of swap() is used in a few macros after that, so
completely removing it might not be the best course of action.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264877-29464-S3DMD5fPNW>