Guest User

Untitled

a guest
May 27th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. $ ../cpla.sh p178-2
  2. $ clang++ p178-2.cpp -std=c++03 -Wall
  3. p178-2.cpp:12:1: error: declaration of anonymous struct must be a definition
  4. struct [[nodiscard]] error_info { /*...*/ };
  5. ^
  6. p178-2.cpp:12:1: warning: declaration does not declare anything [-Wmissing-declarations]
  7. p178-2.cpp:14:1: error: unknown type name 'error_info'
  8. error_info ei;
  9. ^
  10. p178-2.cpp:15:1: error: unknown type name 'error_info'
  11. error_info & e=ei;
  12. ^
  13. p178-2.cpp:17:1: error: unknown type name 'error_info'
  14. error_info enable_missile_safety_mode(){return ei;}
  15. ^
  16. p178-2.cpp:24:1: error: unknown type name 'error_info'
  17. error_info &foo(){return e;}
  18. ^
  19. 1 warning and 5 errors generated.
  20. $ clang++ p199.cpp -std=c++2a -Wall
  21. p178-2.cpp:20:1: warning: ignoring return value of function declared with 'nodiscard' attribute
  22. [-Wunused-result]
  23. enable_missile_safety_mode(); // warning encouraged
  24. ^~~~~~~~~~~~~~~~~~~~~~~~~~
  25. 1 warning generated.
  26. f(){foo();}
  27. testmissiles(){enable_missile_safety_mode();launch_missiles();}
  28. C++N4741(97)10.6.7 Nodiscard attribute [dcl.attr.nodiscard]p178-2.cpp
  29.  
  30. $ g++-8 p199.cpp -std=c++03 -Wall
  31. p199.cpp:12:20: warning: c++11 attributes only available with -std=c++11 or -std=gnu++11
  32. struct [[nodiscard]] error_info { /*...*/ };
  33. ^
  34. p178-2.cpp: In function 'void test_missiles()':
  35. p199.cpp:20:28: warning: ignoring returned value of type 'error_info', declared with attribute nodiscard [-Wunused-result]
  36. enable_missile_safety_mode(); // warning encouraged
  37. ^
  38. p199.cpp:17:12: note: in call to 'error_info enable_missile_safety_mode()', declared here
  39. error_info enable_missile_safety_mode(){return ei;}
  40. ^~~~~~~~~~~~~~~~~~~~~~~~~~
  41. p178-2.cpp:12:22: note: 'error_info' declared here
  42. struct [[nodiscard]] error_info { /*...*/ };
  43. ^~~~~~~~~~
  44. f(){foo();}
  45. testmissiles(){enable_missile_safety_mode();launch_missiles();}
  46. C++N4741(97)10.6.7 Nodiscard attribute [dcl.attr.nodiscard]p178-2.cpp
  47.  
  48. $ g++-8 p178-2.cpp -std=c++2a -Wall
  49. p178-2.cpp: In function 'void test_missiles()':
  50. p178-2.cpp:20:28: warning: ignoring returned value of type 'error_info', declared with attribute nodiscard [-Wunused-result]
  51. enable_missile_safety_mode(); // warning encouraged
  52. ^
  53. p178-2.cpp:17:12: note: in call to 'error_info enable_missile_safety_mode()', declared here
  54. error_info enable_missile_safety_mode(){return ei;}
  55. ^~~~~~~~~~~~~~~~~~~~~~~~~~
  56. p178-2.cpp:12:22: note: 'error_info' declared here
  57. struct [[nodiscard]] error_info { /*...*/ };
  58. ^~~~~~~~~~
  59. f(){foo();}
  60. testmissiles(){enable_missile_safety_mode();launch_missiles();}
  61. C++N4741(97)10.6.7 Nodiscard attribute [dcl.attr.nodiscard]p178-2.cpp
Add Comment
Please, Sign In to add comment