forked from boostorg/optional
Catching up with N4078
This commit is contained in:
@ -291,7 +291,7 @@ void test_uninitialized_access( T const* )
|
||||
{
|
||||
// This should throw because 'def' is uninitialized
|
||||
T const& n = def.get() ;
|
||||
unused_variable(n);
|
||||
boost::ignore_unused(n);
|
||||
passed = true ;
|
||||
}
|
||||
catch (...) {}
|
||||
@ -302,7 +302,7 @@ void test_uninitialized_access( T const* )
|
||||
{
|
||||
// This should throw because 'def' is uninitialized
|
||||
T const& n = *def ;
|
||||
unused_variable(n);
|
||||
boost::ignore_unused(n);
|
||||
passed = true ;
|
||||
}
|
||||
catch (...) {}
|
||||
@ -312,7 +312,7 @@ void test_uninitialized_access( T const* )
|
||||
try
|
||||
{
|
||||
T v(5) ;
|
||||
unused_variable(v);
|
||||
boost::ignore_unused(v);
|
||||
// This should throw because 'def' is uninitialized
|
||||
*def = v ;
|
||||
passed = true ;
|
||||
@ -325,7 +325,7 @@ void test_uninitialized_access( T const* )
|
||||
{
|
||||
// This should throw because 'def' is uninitialized
|
||||
T v = *(def.operator->()) ;
|
||||
unused_variable(v);
|
||||
boost::ignore_unused(v);
|
||||
passed = true ;
|
||||
}
|
||||
catch (...) {}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
// Copyright (C) 2014, Andrzej Krzemienski.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -9,6 +10,8 @@
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#ifdef ENABLE_TRACE
|
||||
#define TRACE(msg) std::cout << msg << std::endl ;
|
||||
#else
|
||||
@ -37,7 +40,6 @@ void assertion_failed (char const * expr, char const * func, char const * file,
|
||||
|
||||
using boost::optional ;
|
||||
|
||||
template<class T> inline void unused_variable ( const T& ) {}
|
||||
|
||||
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
using boost::swap ;
|
||||
|
@ -85,7 +85,7 @@ void test_function_value_for()
|
||||
{
|
||||
T& v = o0.value();
|
||||
BOOST_CHECK(false);
|
||||
unused_variable(v);
|
||||
boost::ignore_unused(v);
|
||||
}
|
||||
catch(boost::bad_optional_access const&)
|
||||
{
|
||||
@ -194,6 +194,19 @@ void test_function_value_or_eval()
|
||||
}
|
||||
}
|
||||
|
||||
const optional<std::string> makeConstOptVal()
|
||||
{
|
||||
return std::string("something");
|
||||
}
|
||||
|
||||
void test_const_move()
|
||||
{
|
||||
std::string s5 = *makeConstOptVal();
|
||||
std::string s6 = makeConstOptVal().value();
|
||||
boost::ignore_unused(s5);
|
||||
boost::ignore_unused(s6);
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
struct MoveOnly
|
||||
@ -223,13 +236,13 @@ void test_move_only_getters()
|
||||
MoveOnly m2 = makeMoveOnly().value();
|
||||
MoveOnly m3 = makeMoveOnly().value_or(MoveOnly(1));
|
||||
MoveOnly m4 = makeMoveOnly().value_or_eval(moveOnlyDefault);
|
||||
unused_variable(m1);
|
||||
unused_variable(m2);
|
||||
unused_variable(m3);
|
||||
unused_variable(m4);
|
||||
boost::ignore_unused(m1);
|
||||
boost::ignore_unused(m2);
|
||||
boost::ignore_unused(m3);
|
||||
boost::ignore_unused(m4);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
|
||||
|
||||
int test_main( int, char* [] )
|
||||
{
|
||||
@ -238,6 +251,7 @@ int test_main( int, char* [] )
|
||||
test_function_value();
|
||||
test_function_value_or();
|
||||
test_function_value_or_eval();
|
||||
test_const_move();
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
|
Reference in New Issue
Block a user