Skip to content

Commit bc45547

Browse files
committed
Add include of <string> to <system_error>, since things in there return strings. Fixes PR#34529.
llvm-svn: 312923
1 parent 4c2a3ec commit bc45547

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

libcxx/include/system_error

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ template <> struct hash<std::error_condition>;
230230
#include <type_traits>
231231
#include <stdexcept>
232232
#include <__functional_base>
233+
#include <string>
233234

234235
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
235236
#pragma GCC system_header
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10+
// <system_error>
11+
// class error_code
12+
13+
// Make sure that the error_code bits of <system_error> are self-contained.
14+
15+
#include <system_error>
16+
1017
int main()
1118
{
19+
std::error_code x;
20+
(void) x.category(); // returns a std::error_category &
21+
(void) x.default_error_condition(); // std::error_condition
22+
(void) x.message(); // returns a std::string
1223
}

libcxx/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/nothing_to_do.pass.cpp renamed to libcxx/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10+
// <system_error>
11+
// class error_condition
12+
13+
// Make sure that the error_condition bits of <system_error> are self-contained.
14+
15+
#include <system_error>
16+
1017
int main()
1118
{
19+
std::error_condition x = std::errc(0);
20+
(void) x.category(); // returns a std::error_condition &
21+
(void) x.message(); // returns a std::string
1222
}

0 commit comments

Comments
 (0)