https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126071
Bug ID: 126071
Summary: ICE using `std::source_location` in templates
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: benfrantzdale at gmail dot com
Target Milestone: ---
I get an ICE for this:
```cpp
#include <source_location>
template <auto getLine = [](std::source_location loc =
std::source_location::current()) { return loc.line(); }>
struct S {
static constexpr auto line = getLine();
};
int main() {
return S<>::line;
}
```
https://godbolt.org/z/h9dhhE7Ya
and for
```cpp
#include <source_location>
template <int Line = [](std::source_location loc =
std::source_location::current()) { return loc.line(); }()>
struct S {
static constexpr auto line = Line;
};
int main() {
return S<>::line;
}
```
https://godbolt.org/z/zrrqbrcKr