https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126655
Bug ID: 126655
Summary: Error: the value of constexpr bool variable declared
in template for is not usable in a constant expression
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eczbek.void at gmail dot com
Target Milestone: ---
https://godbolt.org/z/dT76c4xrx
```
void f() {
template for (constexpr bool b : { true }) {
requires { requires b; };
}
}
```
```
<source>: In instantiation of 'template for' iteration 1:
<source>:2:31: required from here
2 | template for (constexpr bool b : { true }) {
| ^
<source>:3:37: error: the value of 'b' is not usable in a constant expression
3 | requires { requires b; };
| ^
<source>:2:38: note: 'b' used in its own initializer
2 | template for (constexpr bool b : { true }) {
| ^
```