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

            Bug ID: 105154
           Summary: std::expected<void>::swap missing reset _M_has_value
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include <expected>
#include <cassert>

int main() {
  std::expected<void, int> v;
  std::expected<void, int> e(std::unexpect);
  assert(v.has_value());
  assert(!e.has_value());
  v.swap(e);
  assert(!v.has_value());
  assert(e.has_value());
}

https://godbolt.org/z/qzofoqjzh

Reply via email to