diff --git a/.travis.yml b/.travis.yml index 249a8757..eb00f6fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,21 @@ matrix: branch_pattern: coverity_scan env: COMPILER=g++-5 + # from https://github.com/travis-ci/travis-ci/issues/6120 + - os: linux + env: + - LLVM_VERSION=3.8.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - PATH=$HOME/clang-$LLVM_VERSION/bin:$PATH + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + # - os: linux # compiler: gcc # addons: @@ -55,29 +70,29 @@ matrix: # Clang 3.5 is not able to compile the code, # see https://travis-ci.org/nlohmann/json/jobs/126720186 - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] - packages: ['clang-3.6', 'valgrind'] - env: COMPILER=clang++-3.6 - - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7'] - packages: ['clang-3.7', 'valgrind'] - env: COMPILER=clang++-3.7 - - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8'] - packages: ['clang-3.8', 'valgrind'] - env: COMPILER=clang++-3.8 +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] +# packages: ['clang-3.6', 'valgrind'] +# env: COMPILER=clang++-3.6 +# +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7'] +# packages: ['clang-3.7', 'valgrind'] +# env: COMPILER=clang++-3.7 +# +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8'] +# packages: ['clang-3.8', 'valgrind'] +# env: COMPILER=clang++-3.8 # - os: linux # compiler: clang @@ -90,42 +105,56 @@ matrix: - os: osx osx_image: beta-xcode6.1 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.2 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - # - os: osx - # osx_image: beta-xcode6.3 - # compiler: clang - # env: COMPILER=clang + - os: osx + osx_image: beta-xcode6.3 + compiler: clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode6.4 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.1 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.2 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.3 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ script: - uname -a - $COMPILER --version - - make CXX=$COMPILER CXXFLAGS="-lstdc++" + - make CXX=$COMPILER - ./json_unit "*" - if [ `which valgrind` ]; then valgrind --error-exitcode=1 --leak-check=full ./json_unit ; diff --git a/src/json.hpp b/src/json.hpp index a8902bdb..f66d0b59 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -1461,13 +1461,13 @@ class basic_json @since version 2.0.0 */ - template < typename CompatibleNumberUnsignedType, typename - std::enable_if < - std::is_constructible::value and - std::numeric_limits::is_integer and - !std::numeric_limits::is_signed, - CompatibleNumberUnsignedType >::type - = 0 > + template ::value and + std::numeric_limits::is_integer and + not std::numeric_limits::is_signed, + CompatibleNumberUnsignedType>::type + = 0> basic_json(const CompatibleNumberUnsignedType val) noexcept : m_type(value_t::number_unsigned), m_value(static_cast(val)) @@ -5079,6 +5079,7 @@ class basic_json throw std::domain_error("iterator does not fit current value"); } + // check if range iterators belong to the same JSON object if (first.m_object != last.m_object) { throw std::domain_error("iterators do not fit"); @@ -7332,7 +7333,7 @@ class basic_json @return string representation of the code point - @throw std::out_of_range if code point is >0x10ffff; example: `"code + @throw std::out_of_range if code point is > 0x10ffff; example: `"code points above 0x10FFFF are invalid"` @throw std::invalid_argument if the low surrogate is invalid; example: `""missing or wrong low surrogate""` diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 9fe8ca68..f893aac0 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -1461,13 +1461,13 @@ class basic_json @since version 2.0.0 */ - template < typename CompatibleNumberUnsignedType, typename - std::enable_if < - std::is_constructible::value and - std::numeric_limits::is_integer and - !std::numeric_limits::is_signed, - CompatibleNumberUnsignedType >::type - = 0 > + template ::value and + std::numeric_limits::is_integer and + not std::numeric_limits::is_signed, + CompatibleNumberUnsignedType>::type + = 0> basic_json(const CompatibleNumberUnsignedType val) noexcept : m_type(value_t::number_unsigned), m_value(static_cast(val)) @@ -5079,6 +5079,7 @@ class basic_json throw std::domain_error("iterator does not fit current value"); } + // check if range iterators belong to the same JSON object if (first.m_object != last.m_object) { throw std::domain_error("iterators do not fit"); @@ -7332,7 +7333,7 @@ class basic_json @return string representation of the code point - @throw std::out_of_range if code point is >0x10ffff; example: `"code + @throw std::out_of_range if code point is > 0x10ffff; example: `"code points above 0x10FFFF are invalid"` @throw std::invalid_argument if the low surrogate is invalid; example: `""missing or wrong low surrogate""`