File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ wctrans_t wctrans(const char* property);
59
59
60
60
_LIBCPP_BEGIN_NAMESPACE_STD
61
61
62
+ #if defined(_LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H)
62
63
using ::wint_t _LIBCPP_USING_IF_EXISTS;
63
64
using ::wctrans_t _LIBCPP_USING_IF_EXISTS;
64
65
using ::wctype_t _LIBCPP_USING_IF_EXISTS;
@@ -80,6 +81,7 @@ using ::towlower _LIBCPP_USING_IF_EXISTS;
80
81
using ::towupper _LIBCPP_USING_IF_EXISTS;
81
82
using ::towctrans _LIBCPP_USING_IF_EXISTS;
82
83
using ::wctrans _LIBCPP_USING_IF_EXISTS;
84
+ #endif // _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
83
85
84
86
_LIBCPP_END_NAMESPACE_STD
85
87
Original file line number Diff line number Diff line change @@ -50,8 +50,18 @@ wctrans_t wctrans(const char* property);
50
50
#pragma GCC system_header
51
51
#endif
52
52
53
+ // TODO:
54
+ // In the future, we should unconditionally include_next <wctype.h> here and instead
55
+ // have a mode under which the library does not need libc++'s <wctype.h> or <cwctype>
56
+ // at all (i.e. a mode without wchar_t). As it stands, we need to do that to completely
57
+ // bypass the using declarations in <cwctype> when we did not include <wctype.h>.
58
+ // Otherwise, a using declaration like `using ::wint_t` in <cwctype> will refer to
59
+ // nothing (with using_if_exists), and if we include another header that defines one
60
+ // of these declarations (e.g. <wchar.h>), the second `using ::wint_t` with using_if_exists
61
+ // will fail because it does not refer to the same declaration.
53
62
#if __has_include_next(<wctype.h>)
54
63
# include_next <wctype.h>
64
+ # define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
55
65
#endif
56
66
57
67
#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments