Config.msvc-15.5: Fix tests that can't pass in C++17.

This commit is contained in:
jzmaddock
2017-12-09 12:42:47 +00:00
parent ac0cc94982
commit 305f5a58ef
4 changed files with 33 additions and 15 deletions

View File

@@ -28,6 +28,7 @@ template <class T>
int test_allocator(const T& i) int test_allocator(const T& i)
{ {
typedef std::allocator<int> alloc1_t; typedef std::allocator<int> alloc1_t;
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
typedef typename alloc1_t::size_type size_type; typedef typename alloc1_t::size_type size_type;
typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE;
typedef typename alloc1_t::pointer pointer; typedef typename alloc1_t::pointer pointer;
@@ -35,9 +36,10 @@ int test_allocator(const T& i)
typedef typename alloc1_t::reference reference; typedef typename alloc1_t::reference reference;
typedef typename alloc1_t::const_reference const_reference; typedef typename alloc1_t::const_reference const_reference;
typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE;
#endif
alloc1_t a1; alloc1_t a1;
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
pointer p = a1.allocate(1); pointer p = a1.allocate(1);
const_pointer cp = p; const_pointer cp = p;
a1.construct(p,i); a1.construct(p,i);
@@ -49,7 +51,7 @@ int test_allocator(const T& i)
if(cp != a1.address(cr)) return -1; if(cp != a1.address(cr)) return -1;
a1.destroy(p); a1.destroy(p);
a1.deallocate(p,1); a1.deallocate(p,1);
#endif
return 0; return 0;
} }

View File

@@ -45,7 +45,11 @@ int test()
using std::is_trivially_copyable; using std::is_trivially_copyable;
using std::is_standard_layout; using std::is_standard_layout;
using std::is_pod; using std::is_pod;
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
// deprecated in C++ 17:
using std::is_literal_type; using std::is_literal_type;
using std::result_of;
#endif
using std::is_empty; using std::is_empty;
using std::is_polymorphic; using std::is_polymorphic;
using std::is_abstract; using std::is_abstract;
@@ -99,7 +103,6 @@ int test()
using std::conditional; using std::conditional;
using std::common_type; using std::common_type;
using std::underlying_type; using std::underlying_type;
using std::result_of;
return 0; return 0;
} }

View File

@@ -13,9 +13,13 @@
namespace boost_no_cxx17_iterator_traits { namespace boost_no_cxx17_iterator_traits {
struct iterator : struct iterator
public std::iterator< std::random_access_iterator_tag, char >
{ {
typedef std::random_access_iterator_tag iterator_category;
typedef char value_type;
typedef std::ptrdiff_t distance;
typedef char* pointer;
typedef char& reference;
}; };
struct non_iterator {}; struct non_iterator {};

View File

@@ -28,20 +28,33 @@ template <class T>
int test_allocator(const T& i) int test_allocator(const T& i)
{ {
typedef std::allocator<int> alloc1_t; typedef std::allocator<int> alloc1_t;
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
// stuff deprecated in C++17:
typedef typename alloc1_t::size_type size_type; typedef typename alloc1_t::size_type size_type;
typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE;
typedef typename alloc1_t::pointer pointer; typedef typename alloc1_t::pointer pointer;
typedef typename alloc1_t::const_pointer const_pointer; typedef typename alloc1_t::const_pointer const_pointer;
typedef typename alloc1_t::reference reference; typedef typename alloc1_t::reference reference;
typedef typename alloc1_t::const_reference const_reference; typedef typename alloc1_t::const_reference const_reference;
#endif
typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE; typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE;
typedef typename alloc1_t::BOOST_NESTED_TEMPLATE rebind<double> binder_t;
typedef typename binder_t::other alloc2_t;
alloc1_t a1; alloc1_t a1;
alloc1_t a2(a1); alloc1_t a2(a1);
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
// stuff deprecated in C++17:
typedef typename alloc1_t::BOOST_NESTED_TEMPLATE rebind<double> binder_t;
typedef typename binder_t::other alloc2_t;
alloc2_t a3(a1);
// this chokes early versions of the MSL library
// and isn't currently required by anything in boost
// so don't test for now...
// a3 = a2;
(void)a2;
#endif
#if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700)))
pointer p = a1.allocate(1); pointer p = a1.allocate(1);
const_pointer cp = p; const_pointer cp = p;
a1.construct(p,i); a1.construct(p,i);
@@ -52,15 +65,11 @@ int test_allocator(const T& i)
if(p != a1.address(r)) return -1; if(p != a1.address(r)) return -1;
if(cp != a1.address(cr)) return -1; if(cp != a1.address(cr)) return -1;
a1.destroy(p); a1.destroy(p);
#else
auto p = a1.allocate(1);
#endif
a1.deallocate(p,1); a1.deallocate(p,1);
alloc2_t a3(a1);
// this chokes early versions of the MSL library
// and isn't currently required by anything in boost
// so don't test for now...
// a3 = a2;
(void)a2;
return 0; return 0;
} }