I recently root caused a linking problem in our build after upgrading googletest from 1.8.1 to 1.12.1. Specifically, the problem occurs because we use -fkeep-inline-functions when gcov is enabled and -std=gnu++2a
The linking problem occurs here: (https://github.com/google/googletest/blob/v1.12.x/googletest/include/gtest/gtest-printers.h):
#ifdef __cpp_char8_t
// Overloads for u8 strings.
GTEST_API_ void PrintTo(const char8_t* s, ::std::ostream* os);
inline void PrintTo(char8_t* s, ::std::ostream* os) {
PrintTo(ImplicitCast_<const char8_t*>(s), os);
}
#endif
And here:
// gcc/clang __{u,}int128_t
#if defined(__SIZEOF_INT128__)
GTEST_API_ void PrintTo(__uint128_t v, ::std::ostream* os);
GTEST_API_ void PrintTo(__int128_t v, ::std::ostream* os);
#endif // __SIZEOF_INT128__
The gtest library has the following decl in https://github.com/google/googletest/blob/v1.12.x/googletest/cmake/internal_utils.cmake:
if (NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
target_compile_features(${name} PUBLIC cxx_std_11)
endif()
And in https://github.com/google/googletest/blob/v1.12.x/CMakeLists.txt:
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
What is the most appropriate path forward without having to abandon -fkeep-inline-functions (maybe) or -std=gnu++2a (non-starter, at least for c++20 support)?