Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis doesn't run any tests in C++17 mode #2540

Merged
merged 5 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ matrix:
compiler: gcc
env:
- COMPILER=g++-9
- CXXFLAGS=-std=c++2a
- CXX_STANDARD=17
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
Expand Down Expand Up @@ -294,11 +294,11 @@ matrix:
compiler: clang
env:
- COMPILER=clang++-7
- CXXFLAGS=-std=c++1z
- CXX_STANDARD=17
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-7']
packages: ['g++-6', 'clang-7', 'ninja-build']
packages: ['g++-7', 'clang-7', 'ninja-build']

################
# build script #
Expand All @@ -321,6 +321,9 @@ script:
# by default, use implicit conversions
- if [[ "${IMPLICIT_CONVERSIONS}" == "" ]]; then export IMPLICIT_CONVERSIONS=ON; fi

# append CXX_STANDARD to CMAKE_OPTIONS if required
- CMAKE_OPTIONS+=${CXX_STANDARD:+ -DCMAKE_CXX_STANDARD=$CXX_STANDARD -DCMAKE_CXX_STANDARD_REQUIRED=ON}

# compile and execute unit tests
- mkdir -p build && cd build
- cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DJSON_ImplicitConversions=${IMPLICIT_CONVERSIONS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release
Expand Down
4 changes: 4 additions & 0 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ SOFTWARE.
#include <nlohmann/json_fwd.hpp>
#include <nlohmann/ordered_map.hpp>

#if defined(JSON_HAS_CPP_17)
#include <string_view>
#endif

/*!
@brief namespace for Niels Lohmann
@see https://github.com/nlohmann
Expand Down
4 changes: 4 additions & 0 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16663,6 +16663,10 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
} // namespace nlohmann


#if defined(JSON_HAS_CPP_17)
#include <string_view>
#endif

/*!
@brief namespace for Niels Lohmann
@see https://github.com/nlohmann
Expand Down
4 changes: 0 additions & 4 deletions test/src/unit-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ using nlohmann::json;
#define JSON_HAS_CPP_14
#endif

#if defined(JSON_HAS_CPP_17)
#include <string_view>
#endif

TEST_CASE("value conversion")
{
SECTION("get an object (explicit)")
Expand Down