diff options
author | Dino Radakovic <dinor@google.com> | 2023-04-28 17:15:31 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-28 17:16:07 (GMT) |
commit | 797b0ad2a3a45608ecf5c67e6e289d377a3521ca (patch) | |
tree | 9e42decf174d0cf8518729fae4cce8b867033b56 /googlemock | |
parent | 0bdaac5a1401fffac6b64581efc639734aded793 (diff) | |
download | googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.zip googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.tar.gz googletest-797b0ad2a3a45608ecf5c67e6e289d377a3521ca.tar.bz2 |
Use GTEST_INTERNAL_CPLUSPLUS_LANG instead of __cplusplus
Some versions of MSVC provide incorrect values for the latter and rely on _MSVC_LANG instead.
Fixes #4226.
PiperOrigin-RevId: 527919195
Change-Id: Ifcca4612074f5ebc5337094426866a187f79f90a
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 4 | ||||
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index f569e83..da1675c 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -48,6 +48,7 @@ #include "gmock/internal/gmock-port.h" #include "gtest/gtest-spi.h" #include "gtest/gtest.h" +#include "gtest/internal/gtest-port.h" // Silence C4100 (unreferenced formal parameter) and C4503 (decorated name // length exceeded) for MSVC. @@ -221,7 +222,8 @@ TEST(TypeTraits, IsInvocableRV) { // In C++17 and above, where it's guaranteed that functions can return // non-moveable objects, everything should work fine for non-moveable rsult // types too. -#if defined(__cplusplus) && __cplusplus >= 201703L +#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L { struct NonMoveable { NonMoveable() = default; diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index d07cb5c..221de2d 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -804,7 +804,8 @@ TEST(ExpectCallTest, InfersCardinality1WhenThereIsWillRepeatedly) { "to be called at least once"); } -#if defined(__cplusplus) && __cplusplus >= 201703L +#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L // It should be possible to return a non-moveable type from a mock action in // C++17 and above, where it's guaranteed that such a type can be initialized |