]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/debug/multiset.h
libstdc++: Make debug containers prefer copy ctor to base ctor (PR 90102)
[thirdparty/gcc.git] / libstdc++-v3 / include / debug / multiset.h
index a2d5e717b34460b0cb2169b71a209cf55c2f4def..152ebcd6870dcb1a3efeef9b78c692335497f9a8 100644 (file)
@@ -58,6 +58,16 @@ namespace __debug
       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;
@@ -138,8 +148,8 @@ namespace __debug
                __gnu_debug::__base(__last),
                __comp, __a) { }
 
-      multiset(const _Base& __x)
-      : _Base(__x) { }
+      multiset(_Base_ref __x)
+      : _Base(__x._M_ref) { }
 
 #if __cplusplus < 201103L
       multiset&