Skip to content

Commit ced6259

Browse files
authored
std.cfg: Added support for std::format_error (#6785)
Reference: https://en.cppreference.com/w/cpp/utility/format/format_error
1 parent a63b165 commit ced6259

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cfg/std.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8991,6 +8991,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
89918991
<check>std::underflow_error</check>
89928992
<check>std::regex_error</check>
89938993
<check>std::system_error</check>
8994+
<check>std::format_error</check>
89948995
<check>std::bad_typeid</check>
89958996
<check>std::bad_cast</check>
89968997
<check>std::bad_optional_access</check>

test/cfg/std.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
#ifdef __cpp_lib_span
5858
#include <span>
5959
#endif
60+
#ifdef __cpp_lib_format
61+
#include <format>
62+
#endif
6063

6164
#if __cplusplus <= 201402L
6265
void unreachableCode_std_unexpected(int &x)
@@ -5179,6 +5182,14 @@ struct S_std_as_const { // #12974
51795182
std::list<int> l;
51805183
};
51815184

5185+
#if __cpp_lib_format
5186+
void unreadVariable_std_format_error(char * c)
5187+
{
5188+
// cppcheck-suppress unreadVariable
5189+
std::format_error x(c);
5190+
}
5191+
#endif
5192+
51825193
void containerOutOfBounds_std_string(std::string &var) { // #11403
51835194
std::string s0{"x"};
51845195
// cppcheck-suppress containerOutOfBounds

0 commit comments

Comments
 (0)