Merge pull request #821 from mazong1123/master
Fixed issue #775. Mark the ConvertibleFromAny constructor as explicit, and fix operator overload issue for Unprintable
This commit is contained in:
		
						commit
						b28bef5068
					
				@ -613,7 +613,7 @@ TEST(MatcherCastTest, FromSameType) {
 | 
				
			|||||||
struct ConvertibleFromAny {
 | 
					struct ConvertibleFromAny {
 | 
				
			||||||
  ConvertibleFromAny(int a_value) : value(a_value) {}
 | 
					  ConvertibleFromAny(int a_value) : value(a_value) {}
 | 
				
			||||||
  template <typename T>
 | 
					  template <typename T>
 | 
				
			||||||
  ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
 | 
					  explicit ConvertibleFromAny(const T& /*a_value*/) : value(-1) {
 | 
				
			||||||
    ADD_FAILURE() << "Conversion constructor called";
 | 
					    ADD_FAILURE() << "Conversion constructor called";
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  int value;
 | 
					  int value;
 | 
				
			||||||
@ -867,11 +867,15 @@ class Unprintable {
 | 
				
			|||||||
 public:
 | 
					 public:
 | 
				
			||||||
  Unprintable() : c_('a') {}
 | 
					  Unprintable() : c_('a') {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool operator==(const Unprintable& /* rhs */) { return true; }
 | 
					 | 
				
			||||||
 private:
 | 
					 private:
 | 
				
			||||||
  char c_;
 | 
					  char c_;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					inline bool operator==(const Unprintable& /* lhs */, 
 | 
				
			||||||
 | 
					                       const Unprintable& /* rhs */) { 
 | 
				
			||||||
 | 
					    return true; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(EqTest, CanDescribeSelf) {
 | 
					TEST(EqTest, CanDescribeSelf) {
 | 
				
			||||||
  Matcher<Unprintable> m = Eq(Unprintable());
 | 
					  Matcher<Unprintable> m = Eq(Unprintable());
 | 
				
			||||||
  EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));
 | 
					  EXPECT_EQ("is equal to 1-byte object <61>", Describe(m));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user