]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/variant/test/no_rvalue_to_nonconst_visitation.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / variant / test / no_rvalue_to_nonconst_visitation.cpp
1 // Copyright (c) 2017 Antony Polukhin
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #include "boost/config.hpp"
8 #include "boost/variant.hpp"
9 #include <string>
10
11 struct some_user_provided_visitor_for_lvalues: boost::static_visitor<void> {
12 void operator()(std::string& ) const {}
13 void operator()(int ) const {}
14 };
15
16 int main() {
17 boost::apply_visitor(
18 some_user_provided_visitor_for_lvalues(),
19 boost::variant<int, std::string>("Hello")
20 );
21
22 #ifdef BOOST_MSVC
23 # error Temporaries/rvalues could bind to non-const lvalues on MSVC compilers
24 #endif
25
26 return 0;
27 }