From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- .../variant2/test/variant_default_construct.cpp | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 src/boost/libs/variant2/test/variant_default_construct.cpp (limited to 'src/boost/libs/variant2/test/variant_default_construct.cpp') diff --git a/src/boost/libs/variant2/test/variant_default_construct.cpp b/src/boost/libs/variant2/test/variant_default_construct.cpp new file mode 100644 index 00000000..894934cb --- /dev/null +++ b/src/boost/libs/variant2/test/variant_default_construct.cpp @@ -0,0 +1,103 @@ + +// Copyright 2017 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include +#include +#include + +using namespace boost::variant2; + +struct X +{ + X(); +}; + +struct Y +{ + Y() = delete; +}; + +int main() +{ + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), 0 ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), 0 ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), 0 ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), 0 ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), std::string() ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), std::string() ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), std::string() ); + } + + { + variant v; + + BOOST_TEST_EQ( v.index(), 0 ); + BOOST_TEST_EQ( get<0>(v), std::string() ); + } + + { + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_TRUE((std::is_nothrow_default_constructible>)); + + BOOST_TEST_TRAIT_FALSE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_FALSE((std::is_nothrow_default_constructible>)); + BOOST_TEST_TRAIT_FALSE((std::is_nothrow_default_constructible>)); + + BOOST_TEST_TRAIT_TRUE((std::is_default_constructible>)); + BOOST_TEST_TRAIT_FALSE((std::is_default_constructible>)); + } + + return boost::report_errors(); +} -- cgit v1.2.3