* all GTest/GMock files moved to `test/gtest` directory
* `CMakeLists.txt` created in `test/gtest` from `CMakeLists.txt` in `test`
* GTest/GMock target in CMake renamed to `gtest` (was `gmock`)
* CMake `gtest` target updated to export includes as "gtest/gtest.h" or "gmock/gmock.h" only
* includes in tests updated: "gtest.h" -> "gtest/gtest.h", "gmock.h" -> "gmock/gmock.h"
* removed duplications of `target_include_directories` for GTest/GMock directories (CMake manages them)
Passing a function pointer to fmt::ptr results in:
In file included from /home/mac/git/fmt/test/gmock/gmock.h:238,
from /home/mac/git/fmt/test/format-test.cc:31:
.../fmt/test/format-test.cc: In member function ‘virtual void FormatterTest_FormatPointer_Test::TestBody()’:
.../fmt/test/format-test.cc:1486:56: error: no matching function for call to ‘ptr(void (&)(int, double, std::__cxx11::string))’
format("{}", fmt::ptr(function_pointer_test)));
with GCC and Clang. Let's add an overload to support that usage.
Unfortunately, MSVC would
consider the overload to be ambiguous for unknown reasons:
D:\a\fmt\fmt\test\format-test.cc(1485,1): error C2668: 'fmt::v7::ptr': ambiguous call to overloaded function [D:\a\fmt\build\test\format-test.vcxproj]
D:\a\fmt\fmt\include\fmt/format.h(3742,60): message : could be 'const void *fmt::v7::ptr<void,int,double,std::string>(T (__cdecl *)(int,double,std::string))' [D:\a\fmt\build\test\format-test.vcxproj]
with
[
T=void
]
D:\a\fmt\fmt\include\fmt/format.h(3735,42): message : or 'const void *fmt::v7::ptr<void(int,double,std::string)>(T (__cdecl *))' [D:\a\fmt\build\test\format-test.vcxproj]
with
[
T=void (int,double,std::string)
]
D:\a\fmt\fmt\test\format-test.cc(1486,1): message : while trying to match the argument list '(overloaded-function)' [D:\a\fmt\build\test\format-test.vcxproj]
but luckily this means that the overload is unnecessary in that case
anyway, so we can just make it conditional.
* add test for byte formatting with `FMT_COMPILE`
* fix byte formatting with `FMT_COMPILE`, use `__cpp_lib_byte` macro
* use is not custom mapped type check
* workaround MSVC bug
Problem:
- gcc-10 is generating the following warning at all standards:
test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
test/format-test.cc:108:42: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
108 | s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
| ^~~~~~~~~~~~~~~
- gcc-8 is generating the following warning at all standards:
test/format-test.cc: In member function 'virtual void UtilTest_BitCast_Test::TestBody()':
test/format-test.cc:108:56: error: useless cast to type 'uint64_t' {aka 'long long unsigned int'} [-Werror=useless-cast]
s = fmt::detail::bit_cast<uint32_pair>(uint64_t(~0ull));
^
Solution:
- Cast 0 to a 64 unsigned bit int and then invert.
Co-authored-by: Jonathan Gopel <jgopel@quantlab.com>