mirror of
https://github.com/boostorg/variant.git
synced 2026-07-21 13:43:36 +00:00
Fix test for GCC 4.7 and 4.6
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2017 Antony Polukhin
|
||||
// Copyright (c) 2017-2018 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -6,22 +6,27 @@
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/variant.hpp"
|
||||
#include <string>
|
||||
|
||||
struct foo {};
|
||||
|
||||
struct some_user_provided_visitor_for_lvalues: boost::static_visitor<void> {
|
||||
void operator()(std::string& ) const {}
|
||||
void operator()(foo& ) const {}
|
||||
void operator()(int ) const {}
|
||||
};
|
||||
|
||||
int main() {
|
||||
boost::apply_visitor(
|
||||
some_user_provided_visitor_for_lvalues(),
|
||||
boost::variant<int, std::string>("Hello")
|
||||
boost::variant<int, foo>(foo())
|
||||
);
|
||||
|
||||
#ifdef __GNUC__
|
||||
# if __GNUC__ < 5 && __GNUC_MINOR__ < 8
|
||||
# error This test does not pass on GCC < 4.8 because of the incomplete C++11 support
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# error Temporaries/rvalues could bind to non-const lvalues on MSVC compilers
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user