Skip to content

Commit ec44c6c

Browse files
authored
Merge pull request google#821 from mazong1123/master
Fixed issue google#775. Mark the ConvertibleFromAny constructor as explicit, and fix operator overload issue for Unprintable
2 parents d406cb1 + dc2dbf1 commit ec44c6c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

googlemock/test/gmock-matchers_test.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ TEST(MatcherCastTest, FromSameType) {
613613
struct ConvertibleFromAny {
614614
ConvertibleFromAny(int a_value) : value(a_value) {}
615615
template <typename T>
616-
ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
616+
explicit ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
617617
ADD_FAILURE() << "Conversion constructor called";
618618
}
619619
int value;
@@ -867,11 +867,15 @@ class Unprintable {
867867
public:
868868
Unprintable() : c_('a') {}
869869

870-
bool operator==(const Unprintable& /* rhs */) { return true; }
871870
private:
872871
char c_;
873872
};
874873

874+
inline bool operator==(const Unprintable& /* lhs */,
875+
const Unprintable& /* rhs */) {
876+
return true;
877+
}
878+
875879
TEST(EqTest, CanDescribeSelf) {
876880
Matcher<Unprintable> m = Eq(Unprintable());
877881
EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));

0 commit comments

Comments
 (0)