Merge pull request #216 from tzlaine/develop

Add BOOST_NO_CXX17_IF_CONSTEXPR.
This commit is contained in:
jzmaddock
2018-04-18 19:26:47 +01:00
committed by GitHub
23 changed files with 194 additions and 4 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
#
# Regression test Jamfile for boost configuration setup.
# *** DO NOT EDIT THIS FILE BY HAND ***
# This file was automatically generated on Wed Jan 03 23:31:31 2018
# This file was automatically generated on Tue Mar 6 17:44:35 2018
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
@@ -322,6 +322,9 @@ test-suite "BOOST_NO_CXX14_VARIABLE_TEMPLATES" :
test-suite "BOOST_NO_CXX17_FOLD_EXPRESSIONS" :
[ run ../no_cxx17_fold_expressions_pass.cpp ]
[ compile-fail ../no_cxx17_fold_expressions_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_IF_CONSTEXPR" :
[ run ../no_cxx17_if_constexpr_pass.cpp ]
[ compile-fail ../no_cxx17_if_constexpr_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_INLINE_VARIABLES" :
[ run ../no_cxx17_inline_variables_pass.cpp ]
[ compile-fail ../no_cxx17_inline_variables_fail.cpp ] ;
+45
View File
@@ -0,0 +1,45 @@
/*
Copyright 2018 T. Zachary Laine
(whatwasthataddress@gmail.com)
Distributed under Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
// MACRO: BOOST_NO_CXX17_IF_CONSTEXPR
// TITLE: C++17 if constexpr
// DESCRIPTION: C++17 if constexpr are not supported.
namespace boost_no_cxx17_if_constexpr {
template <typename T, typename U>
struct same
{
static constexpr bool value = false;
};
template <typename T>
struct same<T, T>
{
static constexpr bool value = true;
};
int test()
{
if constexpr (true) {
if constexpr (1 != 0) {
if constexpr (same<int, double>::value) {
static_assert(!same<int, double>::value, "");
return 1;
} else if constexpr (false) {
return 1;
} else {
return 0;
}
}
}
return 1;
}
}
+7
View File
@@ -1158,6 +1158,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CXX14_STD_EXCHANGE);
PRINT_MACRO(BOOST_NO_CXX14_VARIABLE_TEMPLATES);
PRINT_MACRO(BOOST_NO_CXX17_FOLD_EXPRESSIONS);
PRINT_MACRO(BOOST_NO_CXX17_IF_CONSTEXPR);
PRINT_MACRO(BOOST_NO_CXX17_INLINE_VARIABLES);
PRINT_MACRO(BOOST_NO_CXX17_ITERATOR_TRAITS);
PRINT_MACRO(BOOST_NO_CXX17_STD_APPLY);
@@ -1228,6 +1229,12 @@ void print_boost_macros()
// END GENERATED BLOCK
PRINT_MACRO(BOOST_INTEL);
+11 -1
View File
@@ -1,4 +1,4 @@
// This file was automatically generated on Wed Jan 03 23:31:31 2018
// This file was automatically generated on Tue Mar 6 17:44:35 2018
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
@@ -342,6 +342,11 @@ namespace boost_no_cxx14_variable_templates = empty_boost;
#else
namespace boost_no_cxx17_fold_expressions = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_IF_CONSTEXPR
#include "boost_no_cxx17_if_constexpr.ipp"
#else
namespace boost_no_cxx17_if_constexpr = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_INLINE_VARIABLES
#include "boost_no_cxx17_inline_variables.ipp"
#else
@@ -1486,6 +1491,11 @@ int main( int, char *[] )
std::cerr << "Failed test for BOOST_NO_CXX17_FOLD_EXPRESSIONS at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_cxx17_if_constexpr::test())
{
std::cerr << "Failed test for BOOST_NO_CXX17_IF_CONSTEXPR at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
if(0 != boost_no_cxx17_inline_variables::test())
{
std::cerr << "Failed test for BOOST_NO_CXX17_INLINE_VARIABLES at: " << __FILE__ << ":" << __LINE__ << std::endl;
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Tue Mar 6 00:52:32 2018
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_NO_CXX17_IF_CONSTEXPR
// This file should not compile, if it does then
// BOOST_NO_CXX17_IF_CONSTEXPR should not be defined.
// See file boost_no_cxx17_if_constexpr.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifdef BOOST_NO_CXX17_IF_CONSTEXPR
#include "boost_no_cxx17_if_constexpr.ipp"
#else
#error "this file should not compile"
#endif
int main( int, char *[] )
{
return boost_no_cxx17_if_constexpr::test();
}
+37
View File
@@ -0,0 +1,37 @@
// This file was automatically generated on Tue Mar 6 00:52:32 2018
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_NO_CXX17_IF_CONSTEXPR
// This file should compile, if it does not then
// BOOST_NO_CXX17_IF_CONSTEXPR should be defined.
// See file boost_no_cxx17_if_constexpr.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifndef BOOST_NO_CXX17_IF_CONSTEXPR
#include "boost_no_cxx17_if_constexpr.ipp"
#else
namespace boost_no_cxx17_if_constexpr = empty_boost;
#endif
int main( int, char *[] )
{
return boost_no_cxx17_if_constexpr::test();
}