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

James Y Knight via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 1 07:21:31 PST 2022


jyknight added a comment.

So, in doing further testing, I've noticed a problem. Currently, clang cannot compile code that calls a consteval function in a default argument. (see https://github.com/llvm/llvm-project/issues/48230 and https://reviews.llvm.org/D119646)

E.g., `clang -std=c++20 -fsyntax-only consteval.cc` given:

  consteval int foo() { return 1; }
  int bar(int N = foo()) { return N; }
  int main() { return bar(); }

raises "error: cannot take address of consteval function 'foo' outside of an immediate invocation", incorrectly.

The same issue occurs with the consteval std::source_location::current() -- which makes it effectively impossible to use std::source_location::current() as it's intended to be used, in a default-argument.


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