[mapbox-variant] 01/05: Imported Upstream version 1.1.5

Bas Couwenberg sebastic at debian.org
Wed Jan 18 20:59:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mapbox-variant.

commit 66aad213ec27235844d7400d7788458426bfff3a
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Jan 18 20:58:04 2017 +0100

    Imported Upstream version 1.1.5
---
 .travis.yml                    | 188 +++++++++++++++++++++++++----------------
 Makefile                       |  92 +++++++++++++-------
 README.md                      |   2 +-
 include/mapbox/variant.hpp     |  16 +++-
 package.json                   |  10 +++
 test/t/binary_visitor_impl.hpp |   4 +-
 6 files changed, 204 insertions(+), 108 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 4119d9e..0801c0e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,102 +2,136 @@ language: generic
 
 sudo: false
 
-# Save common build configurations as shortcuts, so we can reference them later.
-addons_shortcuts:
-  addons_clang35: &clang35
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ]
-      packages: [ 'clang-3.5', 'llvm-3.5-dev' ]
-  addons_clang36: &clang36
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6' ]
-      packages: [ 'clang-3.6' ]
-  addons_clang37: &clang37
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7' ]
-      packages: [ 'clang-3.7' ]
-  addons_clang38: &clang38
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8' ]
-      packages: [ 'clang-3.8']
-  addons_clang39: &clang39
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise' ]
-      packages: [ 'clang-3.9']
-  addons_gcc47: &gcc47
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test' ]
-      packages: [ 'g++-4.7' ]
-  addons_gcc48: &gcc48
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test' ]
-      packages: [ 'g++-4.8' ]
-  addons_gcc49: &gcc49
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test' ]
-      packages: [ 'g++-4.9' ]
-  addons_gcc5: &gcc5
-    apt:
-      sources: [ 'ubuntu-toolchain-r-test' ]
-      packages: [ 'g++-5' ]
-
 matrix:
   include:
+    # clang++ 3.9 via mason with -flto and -fsanitize=cfi
+    - os: linux
+      compiler: "clang++-39-mason"
+      env: CXX=clang++-3.9 CXXFLAGS="-flto -fsanitize=cfi -fvisibility=hidden" LDFLAGS="-flto -fsanitize=cfi -fvisibility=hidden"
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'libstdc++-4.9-dev' ]
+      before_install:
+        - git submodule update --init
+        - ./.mason/mason install clang++ 3.9.1
+        - export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
+        - ./.mason/mason install binutils 2.27
+        - export PATH=$(./.mason/mason prefix binutils 2.27)/bin:${PATH}
+    # clang++ 3.9 via mason with -fsanitize=address
+    - os: linux
+      compiler: "clang++-39-mason"
+      env: CXX=clang++-3.9 CXXFLAGS="-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fno-common" LDFLAGS="-fsanitize=address" ASAN_OPTIONS=check_initialization_order=1:detect_stack_use_after_return=1
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'libstdc++-4.9-dev' ]
+      before_install:
+        - git submodule update --init
+        - ./.mason/mason install clang++ 3.9.1
+        - export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
+    # clang++ 3.9 via mason with -fsanitize=undefined
+    - os: linux
+      compiler: "clang++-39-mason"
+      env: CXX=clang++-3.9 CXXFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined"
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'libstdc++-4.9-dev' ]
+      before_install:
+        - git submodule update --init
+        - ./.mason/mason install clang++ 3.9.1
+        - export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
+    # clang++ 3.9 via mason with -fsanitize=integer
+    - os: linux
+      compiler: "clang++-39-mason"
+      env: CXX=clang++-3.9 CXXFLAGS="-fsanitize=integer" LDFLAGS="-fsanitize=integer"
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'libstdc++-4.9-dev' ]
+      before_install:
+        - git submodule update --init
+        - ./.mason/mason install clang++ 3.9.1
+        - export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
+    # clang++ 3.9 via mason with -fsanitize=safe-stack
+    - os: linux
+      compiler: "clang++-39-mason"
+      env: CXX=clang++-3.9 CXXFLAGS="-fsanitize=safe-stack" LDFLAGS="-fsanitize=safe-stack"
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'libstdc++-4.9-dev' ]
+      before_install:
+        - git submodule update --init
+        - ./.mason/mason install clang++ 3.9.1
+        - export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
     - os: osx
-      osx_image: xcode7
-      env: TEST_GYP_BUILD=True
+      osx_image: xcode8
+      env: OSX_OLDEST_SUPPORTED=10.7 TEST_GYP_BUILD=True
+      compiler: clang
+    - os: osx
+      osx_image: xcode8
+      env: OSX_OLDEST_SUPPORTED=10.12
       compiler: clang
     - os: linux
       compiler: "clang35"
       env: CXX=clang++-3.5 COVERAGE=True
-      addons: *clang35
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ]
+          packages: [ 'clang-3.5', 'libstdc++-4.9-dev' ]
     - os: linux
       compiler: "clang36"
       env: CXX=clang++-3.6
-      addons: *clang36
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6' ]
+          packages: [ 'clang-3.6' ]
     - os: linux
       compiler: "clang37"
       env: CXX=clang++-3.7
-      addons: *clang37
-    - os: linux
-      compiler: "clang38"
-      env: CXX=clang++-3.8
-      addons: *clang38
-    - os: linux
-      compiler: "clang38"
-      env: CXX=clang++-3.8 CXX_STD=c++14
-      addons: *clang38
-    # not whitelisted yet: https://github.com/travis-ci/apt-package-whitelist/issues/2764
-    #- os: linux
-    #  compiler: "clang39"
-    #  env: CXX=clang++-3.9
-    #  addons: *clang39
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7' ]
+          packages: [ 'clang-3.7' ]
     - os: linux
       compiler: "gcc47"
-      env: CXX=g++-4.7
-      addons: *gcc47
+      env: CXX=g++-4.7 CXXFLAGS="-Wno-parentheses"
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'g++-4.7' ]
     - os: linux
       compiler: "gcc48"
       env: CXX=g++-4.8
-      addons: *gcc48
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'g++-4.8' ]
     - os: linux
       compiler: "gcc49"
       env: CXX=g++-4.9
-      addons: *gcc49
-    - os: linux
-      compiler: "gcc49"
-      env: CXX=g++-4.9 CXX_STD=c++14
-      addons: *gcc49
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'g++-4.9' ]
     - os: linux
       compiler: "gcc5"
-      env: CXX=g++-5 CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"
-      addons: *gcc5
+      env: CXX=g++-5
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'g++-5' ]
     - os: linux
-      compiler: "gcc5"
-      env: CXX=g++-5 CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
-      addons: *gcc5
+      compiler: "gcc6"
+      env: CXX=g++-6 CXX_STD=c++14
+      addons:
+        apt:
+          sources: [ 'ubuntu-toolchain-r-test' ]
+          packages: [ 'g++-6' ]
 
-before_install:
+install:
  - echo ${CXX}
  - if [[ $(uname -s) == 'Linux' ]]; then
      export PYTHONPATH=$(pwd)/.local/lib/python2.7/site-packages;
@@ -108,7 +142,15 @@ before_install:
      PYTHONUSERBASE=$(pwd)/.local pip install --user cpp-coveralls;
    fi
 
-install:
+script:
+ # Build in Release
+ - make test
+ - make bench
+ - make sizes
+ - scripts/run_compilation_failure_tests.sh
+ - make clean;
+ # Build in Debug
+ - export BUILDTYPE=Debug
  - make test
  - make bench
  - make sizes
@@ -118,7 +160,7 @@ install:
      make gyp;
    fi
 
-script:
+after_script:
  - if [[ ${COVERAGE:-0} == 'True' ]]; then
     make clean;
     make coverage;
diff --git a/Makefile b/Makefile
index 10ab7b5..808592d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,53 @@
 MASON = .mason/mason
-BOOST_VERSION = boost 1.60.0
+BOOST_VERSION = 1.62.0
 
 CXX := $(CXX)
 CXX_STD ?= c++11
 
-BOOST_FLAGS = `$(MASON) cflags $(BOOST_VERSION)`
-RELEASE_FLAGS = -O3 -DNDEBUG -march=native -DSINGLE_THREADED -fvisibility-inlines-hidden
-DEBUG_FLAGS = -O0 -g -DDEBUG -fno-inline-functions
-COMMON_FLAGS = -Wall -pedantic -Wextra -Wsign-compare -Wsign-conversion -Wshadow -Wunused-parameter -std=$(CXX_STD)
+BOOST_ROOT = $(shell $(MASON) prefix boost $(BOOST_VERSION))
+BOOST_FLAGS = -isystem $(BOOST_ROOT)/include/
+RELEASE_FLAGS = -O3 -DNDEBUG -march=native -DSINGLE_THREADED -fvisibility-inlines-hidden -fvisibility=hidden
+DEBUG_FLAGS = -O0 -g -DDEBUG -fno-inline-functions -fno-omit-frame-pointer -fPIE
+WARNING_FLAGS = -Werror -Wall -Wextra -pedantic \
+		-Wformat=2 -Wsign-conversion -Wshadow -Wunused-parameter
+
+COMMON_FLAGS = -std=$(CXX_STD)
+COMMON_FLAGS += $(WARNING_FLAGS)
+
 CXXFLAGS := $(CXXFLAGS)
 LDFLAGS := $(LDFLAGS)
 
+export BUILDTYPE ?= Release
+
+OS := $(shell uname -s)
+ifeq ($(OS), Linux)
+  EXTRA_FLAGS = -pthread
+endif
+ifeq ($(OS), Darwin)
+  OSX_OLDEST_SUPPORTED ?= 10.7
+  # we need to explicitly ask for libc++ otherwise the
+  # default will flip back to libstdc++ for mmacosx-version-min < 10.9
+  EXTRA_FLAGS = -stdlib=libc++ -mmacosx-version-min=$(OSX_OLDEST_SUPPORTED)
+endif
+
+
+ifeq ($(BUILDTYPE),Release)
+	FINAL_CXXFLAGS := $(COMMON_FLAGS) $(RELEASE_FLAGS) $(CXXFLAGS) $(EXTRA_FLAGS)
+else
+	FINAL_CXXFLAGS := $(COMMON_FLAGS) $(DEBUG_FLAGS) $(CXXFLAGS) $(EXTRA_FLAGS)
+endif
+
+
+
 ALL_HEADERS = $(shell find include/mapbox/ '(' -name '*.hpp' ')')
 
 all: out/bench-variant out/unique_ptr_test out/unique_ptr_test out/recursive_wrapper_test out/binary_visitor_test out/lambda_overload_test out/hashable_test
 
-mason_packages:
+$(MASON):
 	git submodule update --init .mason
-	$(MASON) install $(BOOST_VERSION)
+
+mason_packages/headers/boost: $(MASON)
+	$(MASON) install boost $(BOOST_VERSION)
 
 ./deps/gyp:
 	git clone --depth 1 https://chromium.googlesource.com/external/gyp.git ./deps/gyp
@@ -25,35 +55,35 @@ mason_packages:
 gyp: ./deps/gyp
 	deps/gyp/gyp --depth=. -Goutput_dir=./ --generator-output=./out -f make
 	make V=1 -C ./out tests
-	./out/Release/tests
+	./out/$(BUILDTYPE)/tests
 
-out/bench-variant-debug: Makefile mason_packages test/bench_variant.cpp
+out/bench-variant-debug: Makefile mason_packages/headers/boost test/bench_variant.cpp
 	mkdir -p ./out
-	$(CXX) -o out/bench-variant-debug test/bench_variant.cpp -I./include -Itest/include -pthreads $(DEBUG_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/bench-variant-debug test/bench_variant.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/bench-variant: Makefile mason_packages test/bench_variant.cpp
+out/bench-variant: Makefile mason_packages/headers/boost test/bench_variant.cpp
 	mkdir -p ./out
-	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/unique_ptr_test: Makefile mason_packages test/unique_ptr_test.cpp
+out/unique_ptr_test: Makefile mason_packages/headers/boost test/unique_ptr_test.cpp
 	mkdir -p ./out
-	$(CXX) -o out/unique_ptr_test test/unique_ptr_test.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/unique_ptr_test test/unique_ptr_test.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/recursive_wrapper_test: Makefile mason_packages test/recursive_wrapper_test.cpp
+out/recursive_wrapper_test: Makefile mason_packages/headers/boost test/recursive_wrapper_test.cpp
 	mkdir -p ./out
-	$(CXX) -o out/recursive_wrapper_test test/recursive_wrapper_test.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/recursive_wrapper_test test/recursive_wrapper_test.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/binary_visitor_test: Makefile mason_packages test/binary_visitor_test.cpp
+out/binary_visitor_test: Makefile mason_packages/headers/boost test/binary_visitor_test.cpp
 	mkdir -p ./out
-	$(CXX) -o out/binary_visitor_test test/binary_visitor_test.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/binary_visitor_test test/binary_visitor_test.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/lambda_overload_test: Makefile mason_packages test/lambda_overload_test.cpp
+out/lambda_overload_test: Makefile mason_packages/headers/boost test/lambda_overload_test.cpp
 	mkdir -p ./out
-	$(CXX) -o out/lambda_overload_test test/lambda_overload_test.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/lambda_overload_test test/lambda_overload_test.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
-out/hashable_test: Makefile mason_packages test/hashable_test.cpp
+out/hashable_test: Makefile mason_packages/headers/boost test/hashable_test.cpp
 	mkdir -p ./out
-	$(CXX) -o out/hashable_test test/hashable_test.cpp -I./include -Itest/include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
+	$(CXX) -o out/hashable_test test/hashable_test.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS)
 
 bench: out/bench-variant out/unique_ptr_test out/unique_ptr_test out/recursive_wrapper_test out/binary_visitor_test
 	./out/bench-variant 100000
@@ -63,11 +93,11 @@ bench: out/bench-variant out/unique_ptr_test out/unique_ptr_test out/recursive_w
 
 out/unit.o: Makefile test/unit.cpp
 	mkdir -p ./out
-	$(CXX) -c -o $@ test/unit.cpp -Itest/include $(DEBUG_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS)
+	$(CXX) -c -o $@ test/unit.cpp -isystem test/include $(FINAL_CXXFLAGS)
 
 out/%.o: test/t/%.cpp Makefile $(ALL_HEADERS)
 	mkdir -p ./out
-	$(CXX) -c -o $@ $< -Iinclude -Itest/include $(DEBUG_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS)
+	$(CXX) -c -o $@ $< -Iinclude -isystem test/include $(FINAL_CXXFLAGS)
 
 out/unit: out/unit.o out/binary_visitor_1.o out/binary_visitor_2.o out/binary_visitor_3.o out/binary_visitor_4.o out/binary_visitor_5.o out/binary_visitor_6.o out/issue21.o out/issue122.o out/mutating_visitor.o out/optional.o out/recursive_wrapper.o out/sizeof.o out/unary_visitor.o out/variant.o
 	mkdir -p ./out
@@ -78,14 +108,14 @@ test: out/unit
 
 coverage:
 	mkdir -p ./out
-	$(CXX) -o out/cov-test --coverage test/unit.cpp test/t/*.cpp -I./include -Itest/include $(DEBUG_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS)
+	$(CXX) -o out/cov-test --coverage test/unit.cpp test/t/*.cpp -I./include -isystem test/include $(FINAL_CXXFLAGS) $(LDFLAGS)
 
 sizes: Makefile
 	mkdir -p ./out
-	@$(CXX) -o ./out/our_variant_hello_world.out include/mapbox/variant.hpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) &&  du -h ./out/our_variant_hello_world.out
-	@$(CXX) -o ./out/boost_variant_hello_world.out `$(MASON) prefix boost 1.60.0`/include/boost/variant.hpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(BOOST_FLAGS) &&  du -h ./out/boost_variant_hello_world.out
-	@$(CXX) -o ./out/our_variant_hello_world ./test/our_variant_hello_world.cpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) &&  du -h ./out/our_variant_hello_world
-	@$(CXX) -o ./out/boost_variant_hello_world ./test/boost_variant_hello_world.cpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS)  $(BOOST_FLAGS) &&  du -h ./out/boost_variant_hello_world
+	@$(CXX) -o ./out/our_variant_hello_world.out include/mapbox/variant.hpp -I./include $(FINAL_CXXFLAGS) &&  du -h ./out/our_variant_hello_world.out
+	@$(CXX) -o ./out/boost_variant_hello_world.out $(BOOST_ROOT)/include/boost/variant.hpp -I./include $(FINAL_CXXFLAGS) $(BOOST_FLAGS) &&  du -h ./out/boost_variant_hello_world.out
+	@$(CXX) -o ./out/our_variant_hello_world ./test/our_variant_hello_world.cpp -I./include $(FINAL_CXXFLAGS) &&  du -h ./out/our_variant_hello_world
+	@$(CXX) -o ./out/boost_variant_hello_world ./test/boost_variant_hello_world.cpp -I./include $(FINAL_CXXFLAGS) $(BOOST_FLAGS) &&  du -h ./out/boost_variant_hello_world
 
 profile: out/bench-variant-debug
 	mkdir -p profiling/
@@ -102,8 +132,8 @@ clean:
 	rm -f *.gcda *.gcno
 
 pgo: out Makefile
-	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS) -pg -fprofile-generate
+	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS) -pg -fprofile-generate
 	./test-variant 500000 >/dev/null 2>/dev/null
-	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include $(RELEASE_FLAGS) $(COMMON_FLAGS) $(CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS) -fprofile-use
+	$(CXX) -o out/bench-variant test/bench_variant.cpp -I./include $(FINAL_CXXFLAGS) $(LDFLAGS) $(BOOST_FLAGS) -fprofile-use
 
 .PHONY: sizes test
diff --git a/README.md b/README.md
index 0e274b0..c230826 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ Response ret = makeRequest();
 To see which type the `Response` holds you pattern match on the variant unwrapping the underlying value:
 
 ```c++
-ret.match([] (Result r) { print(r.object); }
+ret.match([] (Result r) { print(r.object); },
           [] (Error e)  { print(e.message); });
 ```
 
diff --git a/include/mapbox/variant.hpp b/include/mapbox/variant.hpp
index fb0f77e..9b73934 100644
--- a/include/mapbox/variant.hpp
+++ b/include/mapbox/variant.hpp
@@ -107,11 +107,24 @@ struct direct_type<T>
 
 #if __cpp_lib_logical_traits >= 201510L
 
+using std::conjunction;
 using std::disjunction;
 
 #else
 
 template <typename...>
+struct conjunction : std::true_type {};
+
+template <typename B1>
+struct conjunction<B1> : B1 {};
+
+template <typename B1, typename B2>
+struct conjunction<B1, B2> : std::conditional<B1::value, B2, B1>::type {};
+
+template <typename B1, typename... Bs>
+struct conjunction<B1, Bs...> : std::conditional<B1::value, conjunction<Bs...>, B1>::type {};
+
+template <typename...>
 struct disjunction : std::false_type {};
 
 template <typename B1>
@@ -595,7 +608,8 @@ public:
         helper_type::copy(old.type_index, &old.data, &data);
     }
 
-    VARIANT_INLINE variant(variant<Types...>&& old) noexcept(std::is_nothrow_move_constructible<types>::value)
+    VARIANT_INLINE variant(variant<Types...>&& old)
+        noexcept(detail::conjunction<std::is_nothrow_move_constructible<Types>...>::value)
         : type_index(old.type_index)
     {
         helper_type::move(old.type_index, &old.data, &data);
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..82ea26a
--- /dev/null
+++ b/package.json
@@ -0,0 +1,10 @@
+{
+    "name": "variant",
+    "version": "1.3.0",
+    "description": "C++11/C++14 variant",
+    "main": "./package.json",
+    "repository"   :  {
+      "type" : "git",
+      "url"  : "git://github.com/mapbox/variant.git"
+    }
+}
diff --git a/test/t/binary_visitor_impl.hpp b/test/t/binary_visitor_impl.hpp
index f2db68b..4ee1f08 100644
--- a/test/t/binary_visitor_impl.hpp
+++ b/test/t/binary_visitor_impl.hpp
@@ -160,8 +160,8 @@ struct swap_visitor
     {
         using T = typename std::common_type<A, B>::type;
         T tmp = a;
-        a = b;
-        b = tmp;
+        a = static_cast<A>(b);
+        b = static_cast<B>(tmp);
     }
 };
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapbox-variant.git



More information about the Pkg-grass-devel mailing list