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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I think the `intent` of std::optional is have it similar to something like
myoptional (not exactly but you should get the idea) below:
```
struct f
{
  ~f(){}
};

struct myoptional
{
  f *t = nullptr;
  constexpr ~myoptional() {reset(); }
  constexpr void reset() {  delete t; t = nullptr; }
  constexpr myoptional &operator =(const f&&a) { reset(); t = new f(a); return
*this; }
};

static_assert([] {
  myoptional opt;
  opt.reset();
  //opt = f{};
  return true;
}());
```

If so then libstdc++ is still correct.

Reply via email to