https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105050
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-03-25
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If it just said that the body of swap(expected&) was not a constant expression,
that would have been an improvement. I spent ages trying to understand what was
wrong with this line:
x.ii:15:7: error: expression '<statement>' is not a constant expression
15 | if (this->has_value())
| ^~
In fact the `if` statements are the only ones in the function that *are*
constant expressions, the problem is all the *other* statements. All the return
statements have non-constant operands.