Skip to content

Fix compile warning about swap for IndexedString in wrong namespace

Milian Wolff requested to merge work/indexedstring-swap into master

Instead of using a friend, use a member and an inline free function that calls the member function. This fixes the warning for me and hopefully keeps the code working as intended:

/home/milian/projects/kde/src/kdevelop/kdevplatform/serialization/indexedstring.cpp:305:6: warning: ‘void KDevelop::swap(KDevelop::IndexedString&, KDevelop::IndexedString&)’ has not been declared within ‘KDevelop’
  305 | void KDevelop::swap(IndexedString& a, IndexedString& b) noexcept
      |      ^~~~~~~~
In file included from /home/milian/projects/kde/src/kdevelop/kdevplatform/serialization/indexedstring.cpp:8:
/home/milian/projects/kde/src/kdevelop/kdevplatform/serialization/indexedstring.h:170:50: note: only here as a ‘friend’
  170 |     friend KDEVPLATFORMSERIALIZATION_EXPORT void swap(IndexedString&, IndexedString&) noexcept;
      |                                                  ^~~~

Merge request reports