Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gmock_matchers_test.cc doesn’t build with RTTI off #610

Closed
markmentovai opened this issue Oct 12, 2015 · 2 comments
Closed

gmock_matchers_test.cc doesn’t build with RTTI off #610

markmentovai opened this issue Oct 12, 2015 · 2 comments

Comments

@markmentovai
Copy link
Member

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.

@markmentovai
Copy link
Member Author

If it’s desirable to disable the WhenDynamicCastToTest tests in gmock-matchers_test.cc, that can be achieved with #612.

@BillyDonahue
Copy link
Contributor

done. thanks!

dneto0 added a commit to dneto0/SPIRV-Tools that referenced this issue Dec 1, 2015
The tests now use mocked methods.  This requires runtime type
information for those test classes.
google/googletest#610

This has been fixed recently upstream in googletest.  Until we pick
up that fix, add -frtti for the the test executable only.
dneto0 added a commit to dneto0/shaderc that referenced this issue Dec 1, 2015
We recommend something newer than googletest 1.7.0 because
we want to pick up a fix for an RTTI issue related to mocking
google/googletest#610
That's fixed on the googletest master branch after 2015-11-10.
dneto0 added a commit to dneto0/shaderc that referenced this issue Dec 1, 2015
We recommend something newer than googletest 1.7.0 because
we want to pick up a fix for an RTTI issue related to mocking
google/googletest#610
That's fixed on the googletest master branch after 2015-11-10.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants