fork download
  1. #include <memory> // std::unique_ptr
  2.  
  3. struct Foo
  4. {
  5. const std::unique_ptr<void> bar;
  6.  
  7. Foo(Foo&& other) : bar( static_cast<std::unique_ptr<void>&&>( other.bar ) ) {}
  8. };
  9.  
  10. int main() {}
  11.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor 'Foo::Foo(Foo&&)':
prog.cpp:7:77: error: invalid static_cast from type 'const std::unique_ptr<void>' to type 'std::unique_ptr<void>&&'
stdout
Standard output is empty