https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126233

--- Comment #1 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
Just noting clang says `function_name()` is an empty string in these cases

```cpp

#include <cassert>
#include <source_location>

consteval int strlen(const char* a) {
  int len = 0;
  while (a[len]) ++len;
  return len;
}

consteval bool check(std::source_location loc) {
  assert(loc.line() == 16);
  assert(strlen(loc.function_name()) == 0);
  return true;
}

template<auto S = check(std::source_location::current())>
void fn() {}

int main() { fn(); }
```

Godbolt: https://godbolt.org/z/o6dM6Y9PK

Reply via email to