[colobot] 41/377: Fix ambiguous overload resolution

Didier Raboud odyx at moszumanska.debian.org
Wed Mar 30 13:33:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 13f01597050191b604e7cbbd33c8cdcdc503169b
Author: Piotr Dziwinski <piotrdz at gmail.com>
Date:   Mon Nov 2 22:17:53 2015 +0000

    Fix ambiguous overload resolution
    
    One operator+ for CBotString is enough
---
 src/CBot/CBotDll.h                 | 1 -
 src/CBot/CBotFunction.cpp          | 2 +-
 src/CBot/CBotString.cpp            | 7 -------
 src/CBot/CBotVar.cpp               | 2 +-
 test/unit/CBot/CBotString_test.cpp | 3 ---
 5 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h
index c05e1a5..47dbb48 100644
--- a/src/CBot/CBotDll.h
+++ b/src/CBot/CBotDll.h
@@ -397,7 +397,6 @@ public:
     const CBotString& operator=(const CBotString& stringSrc);
     const CBotString& operator=(const char ch);
     const CBotString& operator=(const char* pString);
-    friend CBotString operator+(const CBotString& string, const char* lpsz);
     CBotString operator+(const CBotString& str);
 
     const CBotString& operator+=(const char ch);
diff --git a/src/CBot/CBotFunction.cpp b/src/CBot/CBotFunction.cpp
index 4bc4303..4ef4021 100644
--- a/src/CBot/CBotFunction.cpp
+++ b/src/CBot/CBotFunction.cpp
@@ -216,7 +216,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
 
         if ( IsOfType(p, ID_NOT) )
         {
-            CBotToken d("~" + p->GetString());
+            CBotToken d(CBotString("~") + p->GetString());
             func->m_token = d;
         }
 
diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp
index 5f7792c..52e63a3 100644
--- a/src/CBot/CBotString.cpp
+++ b/src/CBot/CBotString.cpp
@@ -337,13 +337,6 @@ const CBotString& CBotString::operator=(const CBotString& stringSrc)
     return *this;
 }
 
-CBotString operator+(const CBotString& string, const char * lpsz)
-{
-    CBotString s(string);
-    s += lpsz;
-    return s;
-}
-
 CBotString CBotString::operator+(const CBotString& stringSrc)
 {
     CBotString s(*this);
diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar.cpp
index da5119f..2898a92 100644
--- a/src/CBot/CBotVar.cpp
+++ b/src/CBot/CBotVar.cpp
@@ -1703,7 +1703,7 @@ void CBotVarClass::DecrementUse()
             pThis->SetPointer(this);
             CBotVar*    pResult = nullptr;
 
-            CBotString    nom = "~" + m_pClass->GetName();
+            CBotString    nom = CBotString("~") + m_pClass->GetName();
             long        ident = 0;
 
             while ( pile->IsOk() && !m_pClass->ExecuteMethode(ident, nom, pThis, ppVars, pResult, pile, nullptr)) ;    // waits for the end
diff --git a/test/unit/CBot/CBotString_test.cpp b/test/unit/CBot/CBotString_test.cpp
index ebec202..97576a9 100644
--- a/test/unit/CBot/CBotString_test.cpp
+++ b/test/unit/CBot/CBotString_test.cpp
@@ -277,9 +277,6 @@ TEST(CBotString_Test, operatorAdd)
     botStr1 = botStr1 + botStr3;
     EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());
 
-    botStr1 = "C" + botStr3;
-    EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());
-
     botStr1.Empty();
     botStr1 = botStr2 + cStr1;
     EXPECT_STREQ(botStr1.CStr(), botStr4.CStr());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list