https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125123
Alex <waffl3x at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |waffl3x at gcc dot gnu.org
--- Comment #2 from Alex <waffl3x at gcc dot gnu.org> ---
Further reduced without headers.
It should be noted that a minimal iota implementation exhibits the same
behavior, the array can be done in less code. Simply using a c-array
does not trigger the behavior.
I believe there are two bugs here. I don't think mangling should be
required in this case as `I` is not ODR used. However clearly mangling
is also bugged for cases where `I` is ODR used... although I'm not sure
that case is even allowed as I don't think `I` has static lifetime
technically speaking. I will have to double check the spec to be sure.
Thank you for the concise reproducer and notes. It made it much easier
to reduce it down to this version.
https://godbolt.org/z/jxrPafj3o
```
struct my_array
{
int _arr[2];
constexpr int const*
begin() const
{ return _arr; }
constexpr int const*
end() const
{ return _arr + 2; }
};
template<typename T>
requires true
void f()
{
template for(constexpr int I : my_array{0, 1})
{
}
}
template void f<void>();
```