diff --git a/include/boost/multiprecision/detail/number_base.hpp b/include/boost/multiprecision/detail/number_base.hpp index 99017c92e..94990d8e6 100644 --- a/include/boost/multiprecision/detail/number_base.hpp +++ b/include/boost/multiprecision/detail/number_base.hpp @@ -457,7 +457,7 @@ struct expression_storage_base }; template -struct expression_storage : public expression_storage_base::value> +struct expression_storage : public expression_storage_base::value || std::is_empty::value> {}; template diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fe0d61c59..d261c6f58 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1062,6 +1062,7 @@ test-suite misc : [ run constexpr_test_cpp_int_5.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : : no ] ] [ run constexpr_test_cpp_int_6.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : "msvc:-constexpr:steps10000000" clang:-fconstexpr-steps=268435456 : no ] [ check-target-builds ../config//has_constexpr_limits : -fconstexpr-ops-limit=268435456 ] ] [ run constexpr_test_cpp_int_7.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : "msvc:-constexpr:steps10000000" clang:-fconstexpr-steps=268435456 : no ] ] + [ run constexpr_test_cpp_int_8.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : : no ] ] [ compile test_nothrow_cpp_int.cpp ] [ compile test_nothrow_cpp_rational.cpp ] diff --git a/test/constexpr_test_cpp_int_8.cpp b/test/constexpr_test_cpp_int_8.cpp new file mode 100644 index 000000000..6c780bdae --- /dev/null +++ b/test/constexpr_test_cpp_int_8.cpp @@ -0,0 +1,37 @@ +// (C) Copyright Marco Ribeiro 2026. +// 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) + +#include "constexpr_arithmetric_test.hpp" +#include "boost/multiprecision/cpp_int.hpp" +#include "test.hpp" + +#if !defined(BOOST_MP_NO_CONSTEXPR_DETECTION) && !defined(DISABLE_TESTS) + +int main() +{ + namespace mp = boost::multiprecision; + + using int512_et_off = mp::number, mp::et_off>; + + using int512_et_on = mp::number, mp::et_on>; + + static_assert(mp::abs(int512_et_off(-12345)) == 12345); + static_assert(mp::conj(int512_et_off(100)) == 100); + static_assert(mp::proj(int512_et_off(100)) == 100); + static_assert(mp::powm(int512_et_off(-5), 2, 7) == 4); + + static_assert(mp::abs(int512_et_on(-12345)) == 12345); + static_assert(mp::conj(int512_et_on(100)) == 100); + static_assert(mp::proj(int512_et_on(100)) == 100); + static_assert(mp::powm(int512_et_on(-5), 2, 7) == 4); +} +#else +int main() {} +#endif +