From 0c1d01d30a4034de286c5e379120fd7adc706b27 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 3 May 2022 00:42:20 +0300 Subject: [PATCH] Removed noexcept from string_view::compare that may throw. One overload of string_view::compare calls substr internally, which may throw. This makes compare potentially throwing. Fixes https://github.com/boostorg/utility/issues/94. --- include/boost/utility/string_view.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp index fe1cfa0..c3be4e3 100644 --- a/include/boost/utility/string_view.hpp +++ b/include/boost/utility/string_view.hpp @@ -201,7 +201,7 @@ namespace boost { } BOOST_CXX14_CONSTEXPR int compare(size_type pos1, size_type n1, basic_string_view x) - const BOOST_NOEXCEPT { + const { return substr(pos1, n1).compare(x); }