File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -26,26 +26,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2626template <class _Func >
2727class __scope_guard {
2828 _Func __func_;
29- bool __moved_from_;
3029
3130public:
32- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __scope_guard (_Func __func) : __func_(std::move(__func)) {}
31+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __scope_guard (_Func __func) : __func_(std::move(__func)) {}
3332 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__scope_guard () { __func_ (); }
3433
35- __scope_guard (const __scope_guard&) = delete ;
34+ __scope_guard (const __scope_guard&) = delete ;
35+ __scope_guard& operator =(const __scope_guard&) = delete ;
36+ __scope_guard& operator =(__scope_guard&&) = delete ;
3637
37- // C++17 has mandatory RVO, so we don't need the move constructor anymore to make __make_scope_guard work.
38+ // C++14 doesn't have mandatory RVO, so we have to provide a declaration even though no compiler will ever generate
39+ // a call to the move constructor.
3840#if _LIBCPP_STD_VER <= 14
39- __scope_guard (__scope_guard&& __other) : __func_(__other.__func_) {
40- _LIBCPP_ASSERT_INTERNAL (!__other.__moved_from_ , " Cannot move twice from __scope_guard" );
41- __other.__moved_from_ = true ;
42- }
41+ private:
42+ __scope_guard (__scope_guard&&);
4343#else
4444 __scope_guard (__scope_guard&&) = delete;
4545#endif
46-
47- __scope_guard& operator =(const __scope_guard&) = delete ;
48- __scope_guard& operator =(__scope_guard&&) = delete ;
4946};
5047
5148template <class _Func >
You can’t perform that action at this time.
0 commit comments