Skip to content

Commit b55336c

Browse files
committed
fix: param noexcept on throwing constructor
1 parent 7cd6702 commit b55336c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

include/boost/url/param.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ struct param
356356
param(
357357
core::string_view key,
358358
core::string_view value,
359-
bool has_value) noexcept
359+
bool has_value)
360360
: key(key)
361361
, value(has_value
362362
? value

test/unit/param.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ struct param_test
4444
// cheap, loses pct-validation
4545
BOOST_CORE_STATIC_ASSERT(std::is_constructible<param_view, param_pct_view>::value);
4646

47+
// param allocates std::string members
48+
BOOST_CORE_STATIC_ASSERT(
49+
!std::is_nothrow_constructible<
50+
param,
51+
core::string_view,
52+
core::string_view,
53+
bool>::value);
54+
4755
// expensive constructions
4856
BOOST_CORE_STATIC_ASSERT(std::is_constructible<param_pct_view, param>::value);
4957
BOOST_CORE_STATIC_ASSERT(std::is_constructible<param_pct_view, param_view>::value);
@@ -163,6 +171,18 @@ struct param_test
163171
BOOST_TEST_GE(qp.value.capacity(), 100);
164172
}
165173

174+
// param(string_view, string_view, bool) - 3-arg ctor
175+
{
176+
{
177+
param qp("key", "value", true);
178+
check(qp, "key", "value", true);
179+
}
180+
{
181+
param qp("key", "value", false);
182+
check(qp, "key", "", false);
183+
}
184+
}
185+
166186
// operator->
167187
{
168188
param qp("key", "value");

0 commit comments

Comments
 (0)