fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. [[noreturn]] void AFunctionThatDoesNotReturn() {}
  6. using FunctionThatNeverReturns = std::add_pointer_t<decltype(AFunctionThatDoesNotReturn)>;
  7.  
  8.  
  9. void foo(){
  10. printf("AAA\n");
  11. throw "boom";
  12.  
  13. }
  14.  
  15. int main() {
  16. // your code goes here
  17.  
  18. FunctionThatNeverReturns test;
  19. test = &foo;
  20.  
  21. [[noreturn]] void (boo*);
  22. boo =&foo;
  23.  
  24. (*test)();
  25. return 0;
  26. }
Compilation error #stdin compilation error #stdout 0s 15232KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:21:3: error: expected identifier before ‘[’ token
  [[noreturn]] void (boo*);
   ^
prog.cpp: In lambda function:
prog.cpp:21:15: error: expected ‘{’ before ‘void’
  [[noreturn]] void (boo*);
               ^~~~
prog.cpp: In function ‘int main()’:
prog.cpp:21:15: error: expected ‘;’ before ‘void’
prog.cpp:22:2: error: ‘boo’ was not declared in this scope
  boo =&foo;
  ^~~
prog.cpp: In function ‘void AFunctionThatDoesNotReturn()’:
prog.cpp:5:49: warning: ‘noreturn’ function does return
 [[noreturn]] void AFunctionThatDoesNotReturn() {}
                                                 ^
stdout
Standard output is empty