]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/variant/test/variant_rvalue_get_with_ampersand_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / variant / test / variant_rvalue_get_with_ampersand_test.cpp
CommitLineData
b32b8144
FG
1//-----------------------------------------------------------------------------
2// boost-libs variant/test/variant_get_test.cpp source file
3// See http://www.boost.org for updates, documentation, and revision history.
4//-----------------------------------------------------------------------------
5//
6// Copyright (c) 2017-2017 Albert Sverdlov
7//
8// Distributed under the Boost Software License, Version 1.0. (See
9// accompanying file LICENSE_1_0.txt or copy at
10// http://www.boost.org/LICENSE_1_0.txt)
11
12#include "boost/variant/get.hpp"
13#include "boost/variant/variant.hpp"
92f5a8d4 14#include "boost/core/lightweight_test.hpp"
b32b8144
FG
15
16#include <boost/move/move.hpp>
17#include <boost/static_assert.hpp>
18
19#include <string>
20
21#define UNUSED(v) (void)(v)
22
23inline void run()
24{
25#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
26 typedef boost::variant<int, std::string> var_t;
27
28 std::string s = "abacaba";
29 var_t v = s;
30
31 // must spit an error at compile-time because of 'std::string&'
32 std::string new_s = boost::strict_get<std::string&>(boost::move(v));
33 UNUSED(new_s);
34#else
35 BOOST_STATIC_ASSERT_MSG(false, "Dummy compile-time error to pass the test on C++03");
36#endif
37}
38
92f5a8d4 39int main()
b32b8144
FG
40{
41 run();
92f5a8d4 42 return boost::report_errors();
b32b8144 43}