https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158
Bug ID: 108158
Summary: modification of '...' is not a constant expression
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Since version 11.3, gcc fails on compiling a (complex) constant expression from
the frozen[0] library. gcc 11.2 is fine, and so are clang and msvc.
I've reduced the code to the following: https://godbolt.org/z/e5bje7v35
It's still a relatively large piece of code, I failed to reduce it more
significantly, sorry about that. The error message is
```
<source>:458:39: in 'constexpr' expansion of
'ze_set.frozen::unordered_set<short unsigned int, 3>::lookup<int,
frozen::elsa<short unsigned int> >(4, frozen::elsa<short unsigned int>())'
<source>:453:32: in 'constexpr' expansion of '((const
frozen::unordered_set<short unsigned int,
3>*)this)->frozen::unordered_set<short unsigned int,
3>::tables_.frozen::bits::pmh_tables<8, frozen::elsa<short unsigned int>
>::lookup<int, frozen::elsa<short unsigned int> >((* & key), (* & hash))'
<source>:458:67: in 'constexpr' expansion of 'frozen::bits::seed_or_index()'
<source>:458:67: error: modification of 'ze_set' is not a constant expression
458 | constexpr auto nocount = ze_set.lookup(4, frozen::elsa<uint16_t>());
|
```
But I don't see where such a modification would happen, and the fact that older
version of gcc and clang and msvc correctly evaluate that expression makes me
think it could be a GCC bug. Maybe bisecting between 11.2 and 11.3 would help
understanding the origin of the regression?
[0] https://github.com/serge-sans-paille/frozen