Skip to content

Commit

Permalink
add default ctor for node types (#2782)
Browse files Browse the repository at this point in the history
Co-authored-by: A. Jiang <[email protected]>
Co-authored-by: Casey Carter <[email protected]>
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
4 people authored Jun 25, 2022
1 parent e9f282d commit 5c2d2ad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions stl/inc/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,10 @@ template <class _Value_type, class _Voidptr>
struct _Flist_node { // forward_list node
using _Nodeptr = _Rebind_pointer_t<_Voidptr, _Flist_node>;

_Nodeptr _Next; // successor node
_Value_type _Myval; // the stored value
_Nodeptr _Next;
_Value_type _Myval = _Returns_exactly<_Value_type>(); // fake a viable constructor to workaround GH-2749

_Flist_node() = default;
_Flist_node(const _Flist_node&) = delete;
_Flist_node& operator=(const _Flist_node&) = delete;

Expand Down
4 changes: 3 additions & 1 deletion stl/inc/list
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ struct _List_node { // list node
using _Nodeptr = _Rebind_pointer_t<_Voidptr, _List_node>;
_Nodeptr _Next; // successor node, or first element if head
_Nodeptr _Prev; // predecessor node, or last element if head
_Value_type _Myval; // the stored value, unused if head
_Value_type _Myval = // the stored value, unused if head
_Returns_exactly<_Value_type>(); // fake a viable constructor to workaround GH-2749

_List_node() = default;
_List_node(const _List_node&) = delete;
_List_node& operator=(const _List_node&) = delete;

Expand Down
9 changes: 3 additions & 6 deletions stl/inc/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -1218,13 +1218,13 @@ struct _Common_type3<void_t<common_type_t<_Ty1, _Ty2>>, _Ty1, _Ty2, _Rest...>
template <class _Ty1, class _Ty2, class... _Rest>
struct common_type<_Ty1, _Ty2, _Rest...> : _Common_type3<void, _Ty1, _Ty2, _Rest...> {};

template <class _Ty>
_Ty _Returns_exactly() noexcept; // not defined

#if _HAS_CXX20
template <class, class, template <class> class, template <class> class>
struct basic_common_reference {};

template <class _Ty>
_Ty _Returns_exactly() noexcept; // not defined

template <class _From>
struct _Copy_cv_impl {
template <class _To>
Expand Down Expand Up @@ -1614,9 +1614,6 @@ template <class _From, class _To>
using is_nothrow_convertible = _Is_nothrow_convertible<_From, _To>;
#endif // _HAS_CXX20

template <class _Ty>
_Ty _Returns_exactly() noexcept; // not defined

template <class _From, class _To, class = void>
struct _Invoke_convertible : false_type {};

Expand Down
4 changes: 3 additions & 1 deletion stl/inc/xtree
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,15 @@ struct _Tree_node {
_Nodeptr _Right; // right subtree, or largest element if head
char _Color; // _Red or _Black, _Black if head
char _Isnil; // true only if head (also nil) node; TRANSITION, should be bool
value_type _Myval; // the stored value, unused if head
value_type _Myval = // the stored value, unused if head
_Returns_exactly<value_type>(); // fake a viable constructor to workaround GH-2749

enum _Redbl { // colors for link to parent
_Red,
_Black
};

_Tree_node() = default;
_Tree_node(const _Tree_node&) = delete;
_Tree_node& operator=(const _Tree_node&) = delete;

Expand Down

0 comments on commit 5c2d2ad

Please sign in to comment.