You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting JSON_DisableEnumSerialization to ON when building JSON for Modern C++ with testing enabled (JSON_BuildTests set also set to ON), the tests do not build and the build fails. Tests that rely on that setting should not be built for library clients who do not want EnumSerialization and the build should succeed.
Reproduction steps
From a fresh clone of nlohmann/json, I ran the following commands to configure and build the library using CMake:
I expect successful building and linking of all executable tests with no errors or warnings. In practice, the compiler produces errors and warnings as detailed below in the Error messages field in this form.
Minimal code example
N/A - just building the tests of the library
Error messages
/workspaces/json/tests/src/unit-conversions.cpp:1272:53: error: expected primary-expression before ‘)’ token
1272 |CHECK(json(cpp_enum::value_1).get<cpp_enum>() == cpp_enum::value_1);
| ^
/workspaces/json/tests/thirdparty/doctest/doctest.h:2427:24: note: in definition of macro ‘DOCTEST_ASSERT_IMPLEMENT_1’
2427 |<<__VA_ARGS__) DOCTEST_CLANG_SUPPRESS_WARNING_POP | ^~~~~~~~~~~/workspaces/json/tests/thirdparty/doctest/doctest.h:2969:20: note: in expansion of macro ‘DOCTEST_CHECK’ 2969 | #define CHECK(...) DOCTEST_CHECK(__VA_ARGS__) | ^~~~~~~~~~~~~/workspaces/json/tests/src/unit-conversions.cpp:1272:9: note: in expansion of macro ‘CHECK’ 1272 | CHECK(json(cpp_enum::value_1).get<cpp_enum>() == cpp_enum::value_1); | ^~~~~gmake[2]: *** [tests/CMakeFiles/test-conversions_cpp11.dir/build.make:76: tests/CMakeFiles/test-conversions_cpp11.dir/src/unit-conversions.cpp.o] Error 1gmake[1]: *** [CMakeFiles/Makefile2:1763: tests/CMakeFiles/test-conversions_cpp11.dir/all] Error 2gmake: *** [Makefile:146: all] Error
Compiler and operating system
gcc12, Ubuntu 22.04.1 x86_64
Library version
3.11.2
Validation
The bug also occurs if the latest version from the develop branch is used.
I propagated the JSON_DisableEnumSerialization flag to the test cases to exclude those that rely on enum conversion. Please take a look @madamsrc@EfesX
I propagated the JSON_DisableEnumSerialization flag to the test cases to exclude those that rely on enum conversion. Please take a look @madamsrc@EfesX
Description
Setting
JSON_DisableEnumSerialization
toON
when building JSON for Modern C++ with testing enabled (JSON_BuildTests
set also set toON
), the tests do not build and the build fails. Tests that rely on that setting should not be built for library clients who do not want EnumSerialization and the build should succeed.Reproduction steps
From a fresh clone of nlohmann/json, I ran the following commands to configure and build the library using CMake:
Expected vs. actual results
I expect successful building and linking of all executable tests with no errors or warnings. In practice, the compiler produces errors and warnings as detailed below in the Error messages field in this form.
Minimal code example
Error messages
Compiler and operating system
gcc12, Ubuntu 22.04.1 x86_64
Library version
3.11.2
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: