Property: Promote note to warning
Property() should not be used against member functions that you do not own. Make this warning more prominent in matchers.md and add it to gmock-matchers.h. PiperOrigin-RevId: 727753777 Change-Id: Idf9155103b04b98efc957ff0d0cf3a8d8662eb72
This commit is contained in:
committed by
Copybara-Service
parent
c00fd25b71
commit
a6ce08abf7
@@ -4453,6 +4453,10 @@ inline PolymorphicMatcher<internal::FieldMatcher<Class, FieldType>> Field(
|
||||
// matches 'matcher'. For example,
|
||||
// Property(&Foo::str, StartsWith("hi"))
|
||||
// matches a Foo object x if and only if x.str() starts with "hi".
|
||||
//
|
||||
// Warning: Don't use `Property()` against member functions that you do not
|
||||
// own, because taking addresses of functions is fragile and generally not part
|
||||
// of the contract of the function.
|
||||
template <typename Class, typename PropertyType, typename PropertyMatcher>
|
||||
inline PolymorphicMatcher<internal::PropertyMatcher<
|
||||
Class, PropertyType, PropertyType (Class::*)() const>>
|
||||
|
||||
Reference in New Issue
Block a user