fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. struct Test
  7. {
  8. void f() && {};
  9. };
  10.  
  11. int main()
  12. {
  13. Test t;
  14. t.f();
  15. Test().f();
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:9: error: passing ‘Test’ as ‘this’ argument discards qualifiers [-fpermissive]
     t.f();
         ^
prog.cpp:8:10: note:   in call to ‘void Test::f() &&’
     void f() && {};
          ^
stdout
Standard output is empty