Compare commits

..

5 Commits

Author SHA1 Message Date
Niels Lohmann
8e8b1b4883 Detect used C++ standard library (#4793)
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-05-25 16:20:37 +02:00
Kuan-Fu, Wu
39c59b89be doc: Fix JSON Pointer example to use direct initialization (#4468)
Changed the example code in the documentation from copy initialization
to direct initialization for `json::json_pointer`.
This prevents compilation errors caused by the constructor being explicit.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-05-25 16:20:36 +02:00
Niels Lohmann
c4c1820c47 # This is a combination of 5 commits.
# This is the 1st commit message:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

# Conflicts:
#	tests/src/unit-regression2.cpp

# This is the commit message #2:

 add test for #4440

# This is the commit message #3:

 add test for #4440

# This is the commit message #4:

 add test for #4440

# This is the commit message #5:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-05-25 16:20:35 +02:00
Niels Lohmann
6cbf2b205a # This is a combination of 3 commits.
# This is the 1st commit message:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

# Conflicts:
#	tests/src/unit-regression2.cpp

# This is the commit message #2:

 add test for #4440

# This is the commit message #3:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-05-25 16:20:34 +02:00
Niels Lohmann
b4a5a4fbbc # This is a combination of 2 commits.
# This is the 1st commit message:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

# Conflicts:
#	tests/src/unit-regression2.cpp

# This is the commit message #2:

 add test for #4440

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-05-25 16:20:34 +02:00
4 changed files with 23 additions and 18 deletions

View File

@@ -266,20 +266,6 @@ jobs:
- name: Build
run: cmake --build build
ci_nvcc:
runs-on: ubuntu-latest
container: nvidia/cuda:12.9.0-devel-ubuntu24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get latest CMake and ninja
uses: lukka/get-cmake@ea004816823209b8d1211e47b216185caee12cc5 # v4.02
- name: Run CMake
run: CXX=nvcc cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
- name: Build
run: cmake --build build --parallel 10
- name: Test
run: cd build ; ctest -j 10 --output-on-failure
ci_test_documentation:
runs-on: ubuntu-latest
strategy:

View File

@@ -75,8 +75,8 @@ target_compile_options(test_main PUBLIC
# https://github.com/nlohmann/json/pull/3229
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=2196>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations;-Wno-deprecated;-Wno-float-equal>
$<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-declarations;-Wno-deprecated;-Wno-float-equal>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=1786>)
target_include_directories(test_main PUBLIC
thirdparty/doctest

View File

@@ -12,8 +12,8 @@ target_compile_options(abi_compat_common INTERFACE
# https://github.com/nlohmann/json/pull/3229
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=2196>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations;-Wno-deprecated;-Wno-float-equal>
$<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-declarations;-Wno-deprecated;-Wno-float-equal>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=1786>)
target_include_directories(abi_compat_common SYSTEM INTERFACE
../thirdparty/doctest

View File

@@ -50,6 +50,11 @@ using ordered_json = nlohmann::ordered_json;
#endif
#endif
// for #4440
#if JSON_HAS_RANGES == 1
#include <ranges>
#endif
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
@@ -1094,6 +1099,20 @@ TEST_CASE("regression tests 2")
CHECK(j.type_name() == "invalid");
}
#endif
#if JSON_HAS_RANGES == 1
SECTION("issue 4440")
{
auto noOpFilter = std::views::filter([](auto&&) noexcept
{
return true;
});
json j = {1, 2, 3};
auto filtered = j | noOpFilter;
CHECK(*filtered.begin() == 1);
}
#endif
}
DOCTEST_CLANG_SUPPRESS_WARNING_POP