https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105128
Bug ID: 105128 Summary: source_location compile error for clang Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- It looks like clang just added source_location implementation but the built-in looks different. Unfortunately, libcxx does not implement this either at this point. However, the testsuite probably tells how clang implements this. https://github.com/llvm/llvm-project/blob/d61487490022aaacc34249475fac3e208c7d767e/clang/test/CodeGenCXX/builtin-source-location.cpp #include<source_location> int main() { std::source_location::current(); } clang++ -o sourcelocation sourcelocation.cc -Ofast -std=c++2b -s -flto=thin -fuse-ld=lld In file included from sourcelocation.cc:1: /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:46:41: error: 'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called using __builtin_ret_type = decltype(__builtin_source_location()); ^ /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:13: error: unknown type name '__builtin_ret_type' current(__builtin_ret_type __p = __builtin_source_location()) noexcept ^ /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:32: error: cannot initialize a parameter of type 'int' with an rvalue of type 'const std::source_location::__impl *' current(__builtin_ret_type __p = __builtin_source_location()) noexcept ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/../../../../include/c++/12.0.1/source_location:52:32: note: passing argument to parameter '__p' here 3 errors generated.