https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128386
--- Comment #2 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
I think this has nothing with `template for` really.
Much simpler example:
```cpp
void foo() {
static constexpr auto x = ^^int;
}
```
Compiled with "-freflection -std=c++26 -fsanitize=undefined"
Compiler error:
```
<source>: In function 'void foo()':
<source>:2:33: error: consteval-only value outside an immediate function
context
2 | static constexpr auto x = ^^int;
| ^~~
```
https://godbolt.org/z/MKTffb1vs
Dropping the sanitizer makes it work.