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

--- Comment #2 from S. Davis Herring <herring at lanl dot gov> ---
So sorry.  For whatever reason, copy/paste works for me thence...

#include<utility>
#include<cstdlib>
#include<unistd.h>

struct A {                      // vaguely unique_ptr-like
  void *p;
  A(A &&a) : p(a.release()) {}
  ~A() {if(p) std::free(p);}    // not that you can't free(nullptr)
  void* release() {return std::exchange(p,nullptr);}
  void swap(A &a) {std::swap(p,a.p);}
  A& operator=(A &&a) {A(std::move(a)).swap(*this); return *this;}
};

void disassemble_me(A &a,A &b) {std::swap(a,b);}

int main() {
  return !!execlp("cat","cat","prog.s",static_cast<const char*>(0));
}

Reply via email to