[libcxx-commits] [PATCH] D92214: [libc++] Implement format_error.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 28 12:50:14 PST 2021

ldionne added a comment.

In D92214#2528876 <https://reviews.llvm.org/D92214#2528876>, @Mordante wrote:

> In D92214#2528690 <https://reviews.llvm.org/D92214#2528690>, @thakis wrote:
>> Hello, this again breaks building with -std=c++17: the cpp file has the definition but not the declaration in that case. Should libc++ sources be built with -std=c++20? Or should the cpp file also check `_LIBCPP_STD_VER`?
> I had this in my original version, but I removed it after review this review comment
> https://reviews.llvm.org/D92214#inline-887948
>> To answer my question: Yes, C++20 should be used, see 3b625060fc915 <https://reviews.llvm.org/rG3b625060fc91598d28196e559196bfc7b9a929f9>.
> That doesn't really answer the question since that made C++20 preferred but not mandatory. That was the intention.
> @ldionne Can you clarify the status of libc++'s C++20 requirements. If optional should I re-add the version check macro's in the .cpp file?

Ugh. That's tough.

First, we can't always build as C++17 because then the dylib can't provide the features it needs to support c++20 (unless we jump through some hoops to compile with C++17 but enable stuff like `char8_t`, which is a no-no).
Second, allowing the library to be built either as C++17 or C++20, but provide different features depending on that, is also a pretty bad idea because then someone could link against that library, try to use some C++20 feature from the headers, and they would get a linker error. That's bad too. That's the current state of things with `char8_t` support AFAICT (@curdeius can confirm or infirm).
Third, people are going to be grumpy if we bump the requirement of building libc++ to C++20. I personally think that's reasonable, but this is obviously causing some trouble since @thakis is here. @thakis, can you explain what's the issue with building libc++ with C++20? I assume Chrome is using an older compiler that doesn't support c++20 yet?

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list