[libcxx-commits] [PATCH] D120634: [Libcxx] Add <source_location> header.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 23 13:50:04 PDT 2022


ldionne added a comment.

In D120634#3811941 <https://reviews.llvm.org/D120634#3811941>, @jyknight wrote:

> At this point, std::source_location::current() does still give the "wrong" result when used as a default argument.
>
> After the discussion in https://reviews.llvm.org/D129488#3762490 about the unfortunate interaction between the specified behavior of source_location and consteval, the issue was brought to WG21 for comment, and is still under discussion there. I thought a possible outcome may be to switch `current()` from being consteval to instead being constexpr, but perhaps the consteval semantics will be changed, instead.
>
> See also https://cplusplus.github.io/CWG/issues/2631.html

Naive question, but would everything work properly if libc++ used `constexpr` instead? As-in, would this patch work if you only changed that `consteval` to `constexpr`?

If so, I think it would be reasonable to do it. Concretely, we'll probably have an answer to this issue by the end of November in Kona, so we'll be able to fix it by the time we release LLVM 16. Also, `constexpr` is strictly more restrictive than `consteval`, so we could even ship it that way if it came to that. It would be subtly non-conforming, but at least it would give the right answer and users could start relying on the functionality, which is quite awaited.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120634/new/

https://reviews.llvm.org/D120634



More information about the libcxx-commits mailing list