Conversation
� Conflicts: � .github/workflows/ubuntu.yml � cmake/ci.cmake
|
ICPC fails to build the test suite.
|
|
Adding if that is still an issue with current doctest. |
| - name: cmake | ||
| run: cmake -S . -B build -DJSON_CI=On | ||
| - name: build | ||
| run: > |
There was a problem hiding this comment.
I'd suggest using the literal style block scalar | over the flow style one > for multiline commands:
run: |
. /opt/intel/oneapi/setvars.sh
cmake --build build --target ci_icpc| $<$<CXX_COMPILER_ID:MSVC>:/bigobj> $<$<BOOL:${MINGW}>:-Wa,-mbig-obj> | ||
|
|
||
| # https://github.com/nlohmann/json/pull/3229 | ||
| $<$<CXX_COMPILER_ID:Intel>:-diag-disable=2196> |
There was a problem hiding this comment.
This may need a version check. It's -wd2196 for older versions but I'm not familiar with ICPC, so I don't know since when the new flag is available. 🤷♂️
Also, 1786 to suppress deprecation warnings.
There was a problem hiding this comment.
I couldn't find a version number in the documentation.
| COMMAND ${CMAKE_COMMAND} | ||
| -DCMAKE_BUILD_TYPE=Debug -GNinja | ||
| -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc | ||
| -DCMAKE_CXX_FLAGS="-DJSON_HAS_FILESYSTEM=0 -DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" |
There was a problem hiding this comment.
Appears as -DJSON_HAS_FILESYSTEM=0\ -DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0 on the commandline and results in:
/__w/json/json/single_include/nlohmann/json.hpp(4116): error: this operator is not allowed in a constant expression
#elif JSON_HAS_FILESYSTEM
Remove? Don't know why <filesystem> detection was an issue on ICPC but might have been fixed by now?
Edit: Remove. Works (almost; see below) without.
|
Intel needs to be excluded here as well. :-( #if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
// JSON_HAS_CPP_17 (do not remove; see note at top of file)
SECTION("issue #3070 - Version 3.10.3 breaks backward-compatibility with 3.10.2 ")
{
nlohmann::detail::std_fs::path text_path("/tmp/text.txt");
json j(text_path);
const auto j_path = j.get<nlohmann::detail::std_fs::path>();
CHECK(j_path == text_path);
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ < 4)
// works everywhere but on MSVC and GCC <8.4
CHECK_THROWS_WITH_AS(nlohmann::detail::std_fs::path(json(1)), "[json.exception.type_error.302] type must be string, but is number", json::type_error);
#endif
}
#endifMaybe this condition should just be changed to: #if defined(__clang__) || ((defined(__GNUC__) && !defined(__INTEL_COMPILER)) && (__GNUC__ > 8 || (__GNUC__ == 8 && __GNUC_MINOR__ >= 4)))
// only known to work on Clang and GCC >=8.4
CHECK_THROWS_WITH_AS(nlohmann::detail::std_fs::path(json(1)), "[json.exception.type_error.302] type must be string, but is number", json::type_error);
#endifEdit: We don't have |
|
Another issue: SECTION("issue #1647 - compile error when deserializing enum if both non-default from_json and non-member operator== exists for other type")
{
#if !(defined(__INTEL_COMPILER) && __cplusplus >= 202000)
{
json j;
NonDefaultFromJsonStruct x(j);
NonDefaultFromJsonStruct y;
CHECK(x == y);
}
#endif
auto val = nlohmann::json("one").get<for_1647>();
CHECK(val == for_1647::one);
json j = val;
}Test fails to compile on ICPC without the preprocessor guard when targeting C++20. These lines compile fine: Edit: First try |
|
Okay. Of course CI just failed so there's at least one more issue to solve... |
This PR adds a CI build step for the Intel C++ Compiler