diff --git a/include/boost/multiprecision/float128.hpp b/include/boost/multiprecision/float128.hpp index 378e2ced2..6b544e758 100644 --- a/include/boost/multiprecision/float128.hpp +++ b/include/boost/multiprecision/float128.hpp @@ -296,6 +296,14 @@ struct float128_backend { return m_value; } + BOOST_MP_CXX14_CONSTEXPR float128_type& data() + { + return m_value; + } + BOOST_MP_CXX14_CONSTEXPR const float128_type& data() const + { + return m_value; + } }; inline BOOST_MP_CXX14_CONSTEXPR void eval_add(float128_backend& result, const float128_backend& a) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ba8eb4c14..1feb0bcc1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1281,6 +1281,7 @@ test-suite misc : [ run git_issue_636.cpp : : : [ check-target-builds ../config//has_float128 : quadmath : no ] ] [ run git_issue_652.cpp ] [ run git_issue_734.cpp ] + [ run git_issue_743.cpp : : : [ check-target-builds ../config//has_float128 : quadmath : no ] ] [ run git_issue_759.cpp : : : [ check-target-builds ../config//has_float128 : quadmath : no ] ] [ compile git_issue_98.cpp : [ check-target-builds ../config//has_float128 : TEST_FLOAT128 quadmath : ] diff --git a/test/git_issue_743.cpp b/test/git_issue_743.cpp new file mode 100644 index 000000000..39cb41f27 --- /dev/null +++ b/test/git_issue_743.cpp @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright 2026 Matt Borland. Distributed under 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: https://github.com/boostorg/multiprecision/issues/743 + +#include +#include "test.hpp" + +int main() +{ + using real = boost::multiprecision::float128; + + constexpr real value {5}; + BOOST_CHECK(value.backend().value() == value.backend().data()); + + real mutable_value {42}; + BOOST_CHECK(mutable_value.backend().value() == mutable_value.backend().data()); + + return boost::report_errors(); +}