Compare commits

...

7 Commits

Author SHA1 Message Date
Peter Dimov
4153a535a0 Update .github/workflows 2021-04-19 20:37:12 +03:00
Peter Dimov
f374ad68a3 Add -DBUILD_TESTING=ON to .yml files; it's not default anymore 2021-03-19 04:18:08 +02:00
Peter Dimov
3bc9a57c9b Merge branch 'feature/issue-26' into develop 2021-03-13 18:23:39 +02:00
Peter Dimov
f39a71ed2f Merge branch 'feature/issue-26-nofix' into feature/issue-26 2021-03-13 01:09:46 +02:00
Peter Dimov
06dde96400 Merge branch 'develop' into feature/issue-26-nofix 2021-03-13 01:09:17 +02:00
Peter Dimov
90cda5339f Disable U&& constructor for derived types 2021-03-12 23:40:14 +02:00
Peter Dimov
f586dc8848 Add test for inherited constructors (refs #26) 2021-03-12 20:15:09 +02:00
5 changed files with 44 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ jobs:
- toolset: gcc-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
install: g++-8
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
@@ -83,6 +84,7 @@ jobs:
compiler: clang++-6.0
cxxstd: "03,11,14,17"
os: ubuntu-18.04
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "03,11,14,17"
@@ -92,6 +94,7 @@ jobs:
compiler: clang++-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
@@ -100,6 +103,10 @@ jobs:
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
cxxstd: "03,11,14,17,2a"
os: macos-10.15

View File

@@ -288,7 +288,7 @@ matrix:
env: CMAKE_TEST=1
script:
- mkdir __build__ && cd __build__
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=variant2 ..
- cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=variant2 ..
- ctest --output-on-failure -R boost_variant2
- os: linux

View File

@@ -1584,7 +1584,7 @@ public:
template<class U,
class Ud = typename std::decay<U>::type,
class E1 = typename std::enable_if< !std::is_same<Ud, variant>::value && !detail::is_in_place_index<Ud>::value && !detail::is_in_place_type<Ud>::value >::type,
class E1 = typename std::enable_if< !std::is_same<Ud, variant>::value && !std::is_base_of<variant, Ud>::value && !detail::is_in_place_index<Ud>::value && !detail::is_in_place_type<Ud>::value >::type,
class V = detail::resolve_overload_type<U&&, T...>,
class E2 = typename std::enable_if<std::is_constructible<V, U&&>::value>::type
>

View File

@@ -119,3 +119,5 @@ run variant_visit_r.cpp : : :
<toolset>gcc,<target-os>windows:<variant>release
<toolset>gcc,<target-os>cygwin:<variant>release
;
compile variant_derived_construct.cpp ;

View File

@@ -0,0 +1,33 @@
// Copyright 2021 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/variant2/variant.hpp>
using namespace boost::variant2;
template<class... T> class X: variant<T...>
{
using base = variant<T...>;
using base::base;
};
struct Y
{
Y( Y const& rhs ) = default;
template<class T> Y( T const& t )
{
t.bar();
}
};
int main()
{
using W = X<int, double, Y>;
W a( 1 );
W b( a );
(void)b;
}