Avoid these ambiguities

This commit is contained in:
Jonny007-MKD 2018-09-15 09:00:39 +02:00
parent 6494f5232b
commit c40f55a229

View File

@ -1193,7 +1193,7 @@ class AdditionalMessage
{ {
public: public:
AdditionalMessage(const char* message) : value(message) {} AdditionalMessage(const char* message) : value(message) {}
AdditionalMessage& operator=(const std::string& message) { value = message; return *this; } void set(const std::string& message) { value = message; }
operator bool() const { return true; } operator bool() const { return true; }
const std::string& get() const { return value; } const std::string& get() const { return value; }
@ -1242,22 +1242,22 @@ private:
} \ } \
catch (const std::exception& e) { \ catch (const std::exception& e) { \
if (!gtest_caught_expected) { \ if (!gtest_caught_expected) { \
message = \ message.set( \
"it throws a different type " \ "it throws a different type " \
"with message: " + std::string(e.what()); \ "with message: " + std::string(e.what())); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \ } \
} \ } \
catch (...) { \ catch (...) { \
if (!gtest_caught_expected) { \ if (!gtest_caught_expected) { \
message = \ message.set( \
"it throws a different type."; \ "it throws a different type."); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \ } \
} \ } \
if (!gtest_caught_expected) { \ if (!gtest_caught_expected) { \
message = \ message.set( \
"it throws nothing."; \ "it throws nothing."); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \ } \
} else \ } else \
@ -1272,7 +1272,7 @@ private:
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \ } \
catch (const std::exception& e) { \ catch (const std::exception& e) { \
message = std::string(": ") + e.what(); \ message.set(std::string(": ") + e.what()); \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} \ } \
catch (...) { \ catch (...) { \