template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates deque(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
__gnu_debug::__base(__last), __a)
{ }
- deque(const _Base& __x)
- : _Base(__x) { }
+ deque(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
deque&
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
~forward_list() = default;
+ forward_list(_Base_ref __x) : _Base(__x._M_ref) { }
+
forward_list&
operator=(const forward_list&) = default;
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates list(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
__gnu_debug::__base(__last), __a)
{ }
- list(const _Base& __x)
- : _Base(__x) { }
+ list(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
list&
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates map(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
// types:
typedef _Key key_type;
~map() = default;
#endif
- map(const _Base& __x)
- : _Base(__x) { }
+ map(_Base_ref __x)
+ : _Base(__x._M_ref) { }
explicit map(const _Compare& __comp,
const _Allocator& __a = _Allocator())
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates multimap(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
// types:
typedef _Key key_type;
__gnu_debug::__base(__last),
__comp, __a) { }
- multimap(const _Base& __x)
- : _Base(__x) { }
+ multimap(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
multimap&
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates multiset(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
// types:
typedef _Key key_type;
__gnu_debug::__base(__last),
__comp, __a) { }
- multiset(const _Base& __x)
- : _Base(__x) { }
+ multiset(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
multiset&
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates set(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
// types:
typedef _Key key_type;
__gnu_debug::__base(__last),
__comp, __a) { }
- set(const _Base& __x)
- : _Base(__x) { }
+ set(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
set&
template<typename _ItT, typename _SeqT>
friend class ::__gnu_debug::_Safe_local_iterator;
+ // Reference wrapper for base class. See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
unordered_map(const unordered_map&) = default;
- unordered_map(const _Base& __x)
- : _Base(__x) { }
+ unordered_map(_Base_ref __x)
+ : _Base(__x._M_ref) { }
unordered_map(unordered_map&&) = default;
template<typename _ItT, typename _SeqT>
friend class ::__gnu_debug::_Safe_local_iterator;
+ // Reference wrapper for base class. See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
unordered_multimap(const unordered_multimap&) = default;
- unordered_multimap(const _Base& __x)
- : _Base(__x) { }
+ unordered_multimap(_Base_ref __x)
+ : _Base(__x._M_ref) { }
unordered_multimap(unordered_multimap&&) = default;
template<typename _ItT, typename _SeqT>
friend class ::__gnu_debug::_Safe_local_iterator;
+ // Reference wrapper for base class. See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
unordered_set(const unordered_set&) = default;
- unordered_set(const _Base& __x)
- : _Base(__x) { }
+ unordered_set(_Base_ref __x)
+ : _Base(__x._M_ref) { }
unordered_set(unordered_set&&) = default;
template<typename _ItT, typename _SeqT>
friend class ::__gnu_debug::_Safe_local_iterator;
+ // Reference wrapper for base class. See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::size_type size_type;
typedef typename _Base::hasher hasher;
unordered_multiset(const unordered_multiset&) = default;
- unordered_multiset(const _Base& __x)
- : _Base(__x) { }
+ unordered_multiset(_Base_ref __x)
+ : _Base(__x._M_ref) { }
unordered_multiset(unordered_multiset&&) = default;
template<typename _ItT, typename _SeqT, typename _CatT>
friend class ::__gnu_debug::_Safe_iterator;
+ // Reference wrapper for base class. Disambiguates vector(const _Base&)
+ // from copy constructor by requiring a user-defined conversion.
+ // See PR libstdc++/90102.
+ struct _Base_ref
+ {
+ _Base_ref(const _Base& __r) : _M_ref(__r) { }
+
+ const _Base& _M_ref;
+ };
+
public:
typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference;
: _Base(__x, __a) { }
vector(vector&& __x, const allocator_type& __a)
- noexcept( noexcept(
- _Base(std::declval<_Base&&>()), std::declval<const allocator_type&>()) )
+ noexcept(noexcept(
+ _Base(std::declval<_Base&&>()), std::declval<const allocator_type&>()))
: _Safe(std::move(__x._M_safe()), __a),
_Base(std::move(__x._M_base()), __a),
_Safe_vector(std::move(__x)) { }
#endif
/// Construction from a normal-mode vector
- vector(const _Base& __x)
- : _Base(__x) { }
+ vector(_Base_ref __x)
+ : _Base(__x._M_ref) { }
#if __cplusplus < 201103L
vector&
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/deque>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::deque<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::deque<int> d(static_cast<std::deque<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/forward_list>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::forward_list<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::forward_list<int> d(static_cast<std::forward_list<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/list>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::list<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::list<int> d(static_cast<std::list<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/map>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::map<int, int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::map<int, int> d(static_cast<std::map<int, int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/map>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::multimap<int, int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::multimap<int, int> d(static_cast<std::multimap<int, int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/set>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::multiset<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::multiset<int> d(static_cast<std::multiset<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/set>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::set<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::set<int> d(static_cast<std::set<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/unordered_map>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::unordered_map<int, int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::unordered_map<int, int> d(static_cast<std::unordered_map<int, int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/unordered_map>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::unordered_multimap<int, int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::unordered_multimap<int, int> d(static_cast<std::unordered_multimap<int, int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/unordered_set>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::unordered_multiset<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::unordered_multiset<int> d(static_cast<std::unordered_multiset<int>>(a));
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/unordered_set>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::unordered_set<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::unordered_set<int> d(static_cast<std::unordered_set<int>>(a));
// { dg-error "value type is destructible" "" { target *-*-* } 0 }
// In Debug Mode the "required from here" errors come from <debug/vector>
-// { dg-error "required from here" "" { target *-*-* } 163 }
+// { dg-error "required from here" "" { target *-*-* } 173 }
// Needed because of PR c++/92193
// { dg-prune-output "deleted function" }
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <debug/vector>
+
+// PR libstdc++/90102
+
+struct AnyCont
+{
+ template<class Cont, class Check = decltype(std::declval<Cont>().clear())>
+ operator Cont () const;
+} a;
+
+// This should use copy constructor, not be ambiguous
+__gnu_debug::vector<int> c(a);
+
+// Ensure construction from base container still works
+__gnu_debug::vector<int> d(static_cast<std::vector<int>>(a));