Skip to content

Commit

Permalink
Return _Nontrivial_dummy_type to <optional> (#2117)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyCarter authored Aug 17, 2021
1 parent 7feac35 commit f75c7f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions stl/inc/optional
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ protected:
_THROW(bad_optional_access{});
}

struct _Nontrivial_dummy_type {
constexpr _Nontrivial_dummy_type() noexcept {
// This default constructor is user-provided to avoid zero-initialization when objects are value-initialized.
}
};
_STL_INTERNAL_STATIC_ASSERT(!is_trivially_default_constructible_v<_Nontrivial_dummy_type>);

template <class _Ty, bool = is_trivially_destructible_v<_Ty>>
struct _Optional_destruct_base { // either contains a value of _Ty or is empty (trivial destructor)
union {
Expand Down
7 changes: 0 additions & 7 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -5786,13 +5786,6 @@ _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_finite(const _Ty _Xx) { // constexpr isf
return _Float_abs_bits(_Xx) < _Traits::_Shifted_exponent_mask;
}

struct _Nontrivial_dummy_type {
constexpr _Nontrivial_dummy_type() noexcept {
// This default constructor is user-provided to avoid zero-initialization when objects are value-initialized.
}
};
_STL_INTERNAL_STATIC_ASSERT(!is_trivially_default_constructible_v<_Nontrivial_dummy_type>);

#if _HAS_CXX17
struct monostate {};
#endif // _HAS_CXX17
Expand Down

0 comments on commit f75c7f5

Please sign in to comment.