diff --git a/checks/Jamfile.v2 b/checks/Jamfile.v2 index 8ecfd756..2c4d4672 100644 --- a/checks/Jamfile.v2 +++ b/checks/Jamfile.v2 @@ -1,6 +1,6 @@ # # *** 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 @@ -111,6 +111,7 @@ obj cxx14_return_type_deduction : test_case.cpp : TEST_BOOST_NO_CXX14_RE obj cxx14_std_exchange : test_case.cpp : TEST_BOOST_NO_CXX14_STD_EXCHANGE ; obj cxx14_variable_templates : test_case.cpp : TEST_BOOST_NO_CXX14_VARIABLE_TEMPLATES ; obj cxx17_fold_expressions : test_case.cpp : TEST_BOOST_NO_CXX17_FOLD_EXPRESSIONS ; +obj cxx17_if_constexpr : test_case.cpp : TEST_BOOST_NO_CXX17_IF_CONSTEXPR ; obj cxx17_inline_variables : test_case.cpp : TEST_BOOST_NO_CXX17_INLINE_VARIABLES ; obj cxx17_iterator_traits : test_case.cpp : TEST_BOOST_NO_CXX17_ITERATOR_TRAITS ; obj cxx17_std_apply : test_case.cpp : TEST_BOOST_NO_CXX17_STD_APPLY ; diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 13df0b90..7c0f8a3f 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -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 @@ -511,6 +511,11 @@ # error "Defect macro BOOST_NO_CXX17_FOLD_EXPRESSIONS is defined." # endif #endif +#ifdef TEST_BOOST_NO_CXX17_IF_CONSTEXPR +# ifdef BOOST_NO_CXX17_IF_CONSTEXPR +# error "Defect macro BOOST_NO_CXX17_IF_CONSTEXPR is defined." +# endif +#endif #ifdef TEST_BOOST_NO_CXX17_INLINE_VARIABLES # ifdef BOOST_NO_CXX17_INLINE_VARIABLES # error "Defect macro BOOST_NO_CXX17_INLINE_VARIABLES is defined." diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 6190e390..cb164f8f 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -239,6 +239,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/include/boost/config/compiler/clang.hpp b/include/boost/config/compiler/clang.hpp index 0fdf331f..a5d13b31 100644 --- a/include/boost/config/compiler/clang.hpp +++ b/include/boost/config/compiler/clang.hpp @@ -290,6 +290,10 @@ # define BOOST_NO_CXX17_STRUCTURED_BINDINGS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // Clang 3.9+ in c++1z #if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L # define BOOST_NO_CXX17_INLINE_VARIABLES diff --git a/include/boost/config/compiler/codegear.hpp b/include/boost/config/compiler/codegear.hpp index 44ca8428..c2cfe15c 100644 --- a/include/boost/config/compiler/codegear.hpp +++ b/include/boost/config/compiler/codegear.hpp @@ -167,6 +167,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // // TR1 macros: // diff --git a/include/boost/config/compiler/common_edg.hpp b/include/boost/config/compiler/common_edg.hpp index d49ceb68..88aba9ac 100644 --- a/include/boost/config/compiler/common_edg.hpp +++ b/include/boost/config/compiler/common_edg.hpp @@ -149,6 +149,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support diff --git a/include/boost/config/compiler/digitalmars.hpp b/include/boost/config/compiler/digitalmars.hpp index e4c5afdd..3e9a3ab0 100644 --- a/include/boost/config/compiler/digitalmars.hpp +++ b/include/boost/config/compiler/digitalmars.hpp @@ -124,6 +124,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if (__DMC__ <= 0x840) #error "Compiler not supported or configured - please reconfigure" diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index 8296520a..e740fd39 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -299,6 +299,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if __GNUC__ >= 7 # define BOOST_FALLTHROUGH __attribute__((fallthrough)) diff --git a/include/boost/config/compiler/gcc_xml.hpp b/include/boost/config/compiler/gcc_xml.hpp index 2b47585a..bdba4ed0 100644 --- a/include/boost/config/compiler/gcc_xml.hpp +++ b/include/boost/config/compiler/gcc_xml.hpp @@ -102,6 +102,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index 99ff0f5e..4bfc01ec 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -167,6 +167,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/include/boost/config/compiler/mpw.hpp b/include/boost/config/compiler/mpw.hpp index d9544345..2292ada0 100644 --- a/include/boost/config/compiler/mpw.hpp +++ b/include/boost/config/compiler/mpw.hpp @@ -116,6 +116,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif // // versions check: diff --git a/include/boost/config/compiler/pathscale.hpp b/include/boost/config/compiler/pathscale.hpp index 94b3f91d..1318d275 100644 --- a/include/boost/config/compiler/pathscale.hpp +++ b/include/boost/config/compiler/pathscale.hpp @@ -129,4 +129,7 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #endif diff --git a/include/boost/config/compiler/sunpro_cc.hpp b/include/boost/config/compiler/sunpro_cc.hpp index 54ad77a3..41b7bcad 100644 --- a/include/boost/config/compiler/sunpro_cc.hpp +++ b/include/boost/config/compiler/sunpro_cc.hpp @@ -182,6 +182,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif // Turn on threading support for Solaris 12. // Ticket #11972 diff --git a/include/boost/config/compiler/vacpp.hpp b/include/boost/config/compiler/vacpp.hpp index c8400a34..cabe844f 100644 --- a/include/boost/config/compiler/vacpp.hpp +++ b/include/boost/config/compiler/vacpp.hpp @@ -178,3 +178,6 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index 748d1407..fc12c181 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -201,6 +201,7 @@ // #if (_MSC_VER < 1911) || (_MSVC_LANG < 201703) # define BOOST_NO_CXX17_STRUCTURED_BINDINGS +# define BOOST_NO_CXX17_IF_CONSTEXPR #endif // MSVC including version 14 has not yet completely diff --git a/include/boost/config/compiler/xlcpp.hpp b/include/boost/config/compiler/xlcpp.hpp index a4c66e40..ee7aa125 100644 --- a/include/boost/config/compiler/xlcpp.hpp +++ b/include/boost/config/compiler/xlcpp.hpp @@ -246,6 +246,10 @@ # define BOOST_NO_CXX17_STRUCTURED_BINDINGS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // Clang 3.9+ in c++1z #if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L # define BOOST_NO_CXX17_INLINE_VARIABLES diff --git a/include/boost/config/compiler/xlcpp_zos.hpp b/include/boost/config/compiler/xlcpp_zos.hpp index bc785b8a..eb1bf2e9 100644 --- a/include/boost/config/compiler/xlcpp_zos.hpp +++ b/include/boost/config/compiler/xlcpp_zos.hpp @@ -153,6 +153,7 @@ #define BOOST_NO_CXX17_STRUCTURED_BINDINGS #define BOOST_NO_CXX17_INLINE_VARIABLES #define BOOST_NO_CXX17_FOLD_EXPRESSIONS +#define BOOST_NO_CXX17_IF_CONSTEXPR // ------------------------------------- diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index 8b1f8c16..bff9133a 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -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 ] ; diff --git a/test/boost_no_cxx17_if_constexpr.ipp b/test/boost_no_cxx17_if_constexpr.ipp new file mode 100644 index 00000000..8c40e69c --- /dev/null +++ b/test/boost_no_cxx17_if_constexpr.ipp @@ -0,0 +1,44 @@ +/* +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 +struct same +{ + static constexpr bool value = false; +}; + +template +struct same +{ + static constexpr bool value = true; +}; + +int test() +{ + if constexpr (true) { + if constexpr (1 != 0) { + if constexpr (same::value) { + return 1; + } else if constexpr (false) { + return 1; + } else { + return 0; + } + } + } + return 1; +} + +} diff --git a/test/config_info.cpp b/test/config_info.cpp index 45ccfaf0..15ea5d4a 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -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); diff --git a/test/config_test.cpp b/test/config_test.cpp index 0b3f9a12..2d27e53c 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -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; diff --git a/test/no_cxx17_if_constexpr_fail.cpp b/test/no_cxx17_if_constexpr_fail.cpp new file mode 100644 index 00000000..63137ff3 --- /dev/null +++ b/test/no_cxx17_if_constexpr_fail.cpp @@ -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 +#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(); +} + diff --git a/test/no_cxx17_if_constexpr_pass.cpp b/test/no_cxx17_if_constexpr_pass.cpp new file mode 100644 index 00000000..bcbd808c --- /dev/null +++ b/test/no_cxx17_if_constexpr_pass.cpp @@ -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 +#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(); +} +