Description
When RTTI is disabled (-fno-rtti) gmock_matchers_test.cc fails to build, even though GTEST_HAS_RTTI is 0:
In file included from …/googlemock/test/gmock-matchers_test.cc:36:
…/googlemock/include/gmock/gmock-matchers.h:2153:13: error: cannot use dynamic_cast with -fno-rtti
To to = dynamic_cast(from);
^
[…long snip…]
…/googlemock/test/gmock-matchers_test.cc:3188:3: note: in instantiation of function template specialization 'testing::internal::PredicateFormatterFromMatcher<testing::PolymorphicMatcher<testing::internal::WhenDynamicCastToMatcher<testing::gmock_matchers_test::Derived *> > >::operator()<testing::gmock_matchers_test::Base >' requested here
EXPECT_THAT(as_base_ptr, WhenDynamicCastTo<Derived>(Not(IsNull())));
^
This is repeated several more times for other uses of WhenDynamicCastTo<>.
I’m in favor of leaving WhenDynamicCastTo<> broken when RTTI is off, or disabling it entirely by wrapping it in #if GTEST_HAS_RTTI in gmock-matchers.h. In either case, all of the WhenDynamicCastToTest tests in gmock-matchers_test.cc should be disabled when GTEST_HAS_RTTI is 0.
Since WhenDynamicCastToTest.Describe already considers GTEST_HAS_RTTI, albeit in a way that can’t possibly work or pass, I’m not sure what was intended here.