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

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If you construct an optional<S> that contains a value, then of course it's
destroyed, and then the destructor needs to be usable in constant expressions:

#include <optional>
struct S { ~S() { } };
S s;
static_assert( not std::optional<S>{s} );


/home/jwakely/gcc/15/include/c++/15.0.0/optional:284:42: error: call to
non-'constexpr' function 'S::~S()'

Reply via email to