Issue 117630
Summary Regression: <chrono> does not compile on macOS with `_XOPEN_SOURCE` defined
Labels new issue
Assignees
Reporter nico
    Repro (minified from absl's time_zone_format.cc):

```
% cat chrono.cc 
#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
#define _XOPEN_SOURCE 500 // Exposes definitions for SUSv2 (UNIX 98).
#endif

#include <chrono>
```

```
% clang++ -I../../buildtools/third_party/libc++ -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -nostdinc++ -isystem../../third_party/libc++/src/include  -c chrono.cc  -std=c++20
In file included from chrono.cc:5:
In file included from ../../third_party/libc++/src/include/chrono:969:
In file included from ../../third_party/libc++/src/include/__chrono/formatter.h:29:
In file included from ../../third_party/libc++/src/include/__chrono/ostream.h:36:
In file included from ../../third_party/libc++/src/include/__format/format_functions.h:21:
In file included from ../../third_party/libc++/src/include/__format/format_context.h:28:
In file included from ../../third_party/libc++/src/include/__locale:14:
In file included from ../../third_party/libc++/src/include/__locale_dir/locale_base_api.h:98:
In file included from ../../third_party/libc++/src/include/__locale_dir/support/apple.h:18:
../../third_party/libc++/src/include/__locale_dir/support/bsd_like.h:149:10: error: no member named 'wcsnrtombs_l' in the global namespace; did you mean '__wcsnrtombs'?
  149 |   return ::wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __loc);
      | ^~
../../third_party/libc++/src/include/__locale_dir/support/bsd_like.h:148:1: note: '__wcsnrtombs' declared here
  148 | __wcsnrtombs(char* __dest, const wchar_t** __src, size_t __nwc, size_t __len, mbstate_t* __ps, __locale_t __loc) {
      | ^
../../third_party/libc++/src/include/__locale_dir/support/bsd_like.h:158:10: error: no member named 'mbsnrtowcs_l' in the global namespace; did you mean '__mbsnrtowcs'?
  158 |   return ::mbsnrtowcs_l(__dest, __src, __nms, __len, __ps, __loc);
      | ^~
../../third_party/libc++/src/include/__locale_dir/support/bsd_like.h:157:1: note: '__mbsnrtowcs' declared here
  157 | __mbsnrtowcs(wchar_t* __dest, const char** __src, size_t __nms, size_t __len, mbstate_t* __ps, __locale_t __loc) {
      | ^
```

(We might be able to work around this by defining `_XOPEN_SOURCE` with a `-D` flag while compiling that file, haven't tried that yet.)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to