Skip to content

Commit

Permalink
Merge pull request #821 from mazong1123/master
Browse files Browse the repository at this point in the history
Fixed issue #775. Mark the ConvertibleFromAny constructor as explicit, and fix operator overload issue for Unprintable
  • Loading branch information
BillyDonahue authored Jul 14, 2016
2 parents d406cb1 + dc2dbf1 commit ec44c6c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions googlemock/test/gmock-matchers_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ TEST(MatcherCastTest, FromSameType) {
struct ConvertibleFromAny {
ConvertibleFromAny(int a_value) : value(a_value) {}
template <typename T>
ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
explicit ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
ADD_FAILURE() << "Conversion constructor called";
}
int value;
Expand Down Expand Up @@ -867,11 +867,15 @@ class Unprintable {
public:
Unprintable() : c_('a') {}

bool operator==(const Unprintable& /* rhs */) { return true; }
private:
char c_;
};

inline bool operator==(const Unprintable& /* lhs */,
const Unprintable& /* rhs */) {
return true;
}

TEST(EqTest, CanDescribeSelf) {
Matcher<Unprintable> m = Eq(Unprintable());
EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));
Expand Down

0 comments on commit ec44c6c

Please sign in to comment.