https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125459

Waffl3x <waffl3x at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |waffl3x at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-08-24
           Keywords|                            |c++26, rejects-valid
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Waffl3x <waffl3x at gcc dot gnu.org> ---
Confirmed.
https://godbolt.org/z/3sfT9ffxG
```
constexpr bool f(int const&) { return true; }

constexpr void g()
{
  f(0);
  contract_assert(f(0));
}

static_assert((g(), true));
```
Swapping the two statements in g works.
```
constexpr void g()
{
  contract_assert(f(0));
  f(0);
}
```
The conditions for this bug appear to be, calling a function that takes
a reference in a constant evaluation, and then calling it again in a
contract_assert in the same constant evaluation.

Reply via email to