https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124910
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #7)
> Ah, so I guess std::optional will need something like:
>
> --- a/libstdc++-v3/include/std/optional
> +++ b/libstdc++-v3/include/std/optional
> @@ -321,6 +321,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {
> _M_engaged = false;
> _M_payload._M_value.~_Stored_type();
> + if (std::__is_constant_evaluated())
> + _M_payload._M_empty = {};
> }
>
> #if __cplusplus >= 202002L
>
> in order for comment #3 to be well-formed.
FWIW using std::construct_at instead fixes comment #3, and the original
mp-units testcase, on its own.