Skip to content

Commit b662a8f

Browse files
committed
fix: encode() noexcept on throwing template
1 parent ab5d812 commit b662a8f

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

include/boost/url/encode.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ encode(
185185
core::string_view s,
186186
CS const& allowed,
187187
encoding_opts opt = {},
188-
StringToken&& token = {}) noexcept;
188+
StringToken&& token = {});
189189

190190
} // urls
191191
} // boost

include/boost/url/impl/encode.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ encode(
278278
core::string_view s,
279279
CS const& allowed,
280280
encoding_opts opt,
281-
StringToken&& token) noexcept
281+
StringToken&& token)
282282
{
283283
BOOST_CORE_STATIC_ASSERT(
284284
grammar::is_charset<CS>::value);

test/unit/encode.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,27 @@ class encode_test
209209
}
210210
}
211211

212+
void
213+
testEncodeNoexcept()
214+
{
215+
// encode() buffer overload must not
216+
// be noexcept (noexcept removal regression)
217+
{
218+
char buf[4];
219+
static_assert(
220+
!noexcept(encode(
221+
buf, sizeof(buf), "x", pchars)),
222+
"");
223+
}
224+
}
225+
212226
void
213227
run()
214228
{
215229
testEncode();
216230
testEncodeExtras();
217231
testEncodeZeroDest();
232+
testEncodeNoexcept();
218233
testJavadocs();
219234
}
220235
};

0 commit comments

Comments
 (0)