summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/variant2/test/variant_derived_construct.cpp
blob: 6844336e64641025f60d56aa5d4adeb403f5b7fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}