From 356635219bc6a9cddd63a70a6da17805116e27f8 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 7 May 2018 18:50:28 +0100 Subject: [PATCH] Fix for is_final which works around GCC bug, see https://github.com/boostorg/type_traits/issues/69 --- include/boost/type_traits/is_final.hpp | 2 +- test/is_final_test.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_final.hpp b/include/boost/type_traits/is_final.hpp index 410d186..21ac93f 100644 --- a/include/boost/type_traits/is_final.hpp +++ b/include/boost/type_traits/is_final.hpp @@ -20,7 +20,7 @@ namespace boost { #ifdef BOOST_IS_FINAL -template struct is_final : public integral_constant::type)> {}; +template struct is_final : public integral_constant {}; #else template struct is_final : public integral_constant {}; #endif diff --git a/test/is_final_test.cpp b/test/is_final_test.cpp index 16f4ea3..2ffffc7 100644 --- a/test/is_final_test.cpp +++ b/test/is_final_test.cpp @@ -14,6 +14,13 @@ #include "check_integral_constant.hpp" #include +template +struct final_template final +{}; +template +struct non_final_template +{}; + TT_TEST_BEGIN(is_final) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, false); @@ -38,9 +45,11 @@ TT_TEST_BEGIN(is_final) # ifndef BOOST_IS_FINAL BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_final::value, true, false); BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_final::value, true, false); + BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_final >::value, true, false); # else BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, true); + BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final >::value, true); # endif #else std::cout << @@ -67,6 +76,7 @@ TT_TEST_BEGIN(is_final) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final::value, false); + BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_final >::value, false); TT_TEST_END