[glibmm/glibmm-2-66] Glib::ustring_Iterator: Accept a warning from clang++



commit e62ebe21a7d2e8d20475073d9bc608658cf8365c
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed May 4 10:00:21 2022 +0200

    Glib::ustring_Iterator: Accept a warning from clang++
    
    The fix in commit 94ab1e5359f3bd9eb8204aadea88e08f52a291d8
    broke ABI. Revert the modification of ustring_Iterator.
    It's difficult to avoid a -Wdeprecated-copy warning from clang++
    without either removing or adding ABI.
    Fixes #98

 glib/glibmm/ustring.h | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index 8746ca6e..fcdbd3ac 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -198,15 +198,15 @@ public:
   using reference = value_type;
   using pointer = void;
 
+  // Warning from clang++ 14.0.0:
+  // definition of implicit copy constructor for ..... is deprecated
+  // because it has a user-declared copy assignment operator [-Wdeprecated-copy]
+  //
+  // It's difficult or impossible to avoid the warning without either removing or adding ABI.
+  // https://gitlab.gnome.org/GNOME/glibmm/-/issues/98
+
   inline ustring_Iterator();
-  // A std::string::iterator can be copied to a std::string::const_iterator.
-  template <typename T2, typename = typename std::enable_if<
-    std::is_same<std::string::const_iterator, T>::value &&
-    std::is_same<std::string::iterator, T2>::value, T2>::type>
-  inline ustring_Iterator(const ustring_Iterator<T2>& other)
-  : pos_(other.base())
-  { }
-  ustring_Iterator(const ustring_Iterator& other) = default;
+  inline ustring_Iterator(const ustring_Iterator<std::string::iterator>& other);
   ustring_Iterator& operator=(const ustring_Iterator& other) = default;
 
   inline value_type operator*() const;
@@ -1169,6 +1169,12 @@ inline ustring_Iterator<T>::ustring_Iterator() : pos_()
 {
 }
 
+template <class T>
+inline ustring_Iterator<T>::ustring_Iterator(const ustring_Iterator<std::string::iterator>& other)
+: pos_(other.base())
+{
+}
+
 template <class T>
 inline typename ustring_Iterator<T>::value_type ustring_Iterator<T>::operator*() const
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]