ref: ff0b9bb0541c78046df5fed1a145d2a7a3113c54
parent: 8f26f74ab97b6011d0153d8b1046f2d96ddc7550
parent: ad228021b3caa4924dd854c8f193d1219095c80f
author: Johann Koenig <johannkoenig@google.com>
date: Thu Sep 20 15:52:33 EDT 2018
Merge "fix UB when initializing parameterized tests"
--- a/third_party/googletest/README.libvpx
+++ b/third_party/googletest/README.libvpx
@@ -20,3 +20,7 @@
LICENSE
README.md
src
+
+- Make WithParamInterface<T>::GetParam static in order to avoid
+ initialization issues
+ https://github.com/google/googletest/pull/1830
--- a/third_party/googletest/src/include/gtest/gtest.h
+++ b/third_party/googletest/src/include/gtest/gtest.h
@@ -1775,11 +1775,8 @@
virtual ~WithParamInterface() {}
// The current parameter value. Is also available in the test fixture's
- // constructor. This member function is non-static, even though it only
- // references static data, to reduce the opportunity for incorrect uses
- // like writing 'WithParamInterface<bool>::GetParam()' for a test that
- // uses a fixture whose parameter type is int.
- const ParamType& GetParam() const {
+ // constructor.
+ static const ParamType& GetParam() {
GTEST_CHECK_(parameter_ != NULL)
<< "GetParam() can only be called inside a value-parameterized test "
<< "-- did you intend to write TEST_P instead of TEST_F?";