Guest User

Untitled

a guest
May 27th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. $ ../cpla.sh p185a
  2. $ clang++ p185a.cpp -std=c++03 -Wall
  3. p185a.cpp:50:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  4. typedef int&& RRI;
  5. ^
  6. p185a.cpp:52:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
  7. [-Wignored-qualifiers]
  8. const LRI& r2 = i; // r2 has the type int&
  9. ^~~~~~
  10. p185a.cpp:53:10: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  11. const LRI&& r3 = i; // r3 has the type int&
  12. ^
  13. p185a.cpp:53:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
  14. [-Wignored-qualifiers]
  15. const LRI&& r3 = i; // r3 has the type int&
  16. ^~~~~~
  17. p185a.cpp:55:4: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  18. RRI&& r5 = 5; // r5 has the type int&&
  19. ^
  20. p185a.cpp:57:13: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  21. decltype(r2)&& r7 = i; // r7 has the type int&
  22. ^
  23. 6 warnings generated.
  24. f(0)
  25. k()h(q)
  26. 0 0 0 0 5 0 0
  27. C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
  28. $ clang++ p185a.cpp -std=c++2a -Wall
  29. p185a.cpp:52:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
  30. [-Wignored-qualifiers]
  31. const LRI& r2 = i; // r2 has the type int&
  32. ^~~~~~
  33. p185a.cpp:53:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
  34. [-Wignored-qualifiers]
  35. const LRI&& r3 = i; // r3 has the type int&
  36. ^~~~~~
  37. 2 warnings generated.
  38. f(0)
  39. k()h(q)
  40. 0 0 0 0 5 0 0
  41. C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
  42.  
  43. $ g++-8 p185a.cpp -std=c++03 -Wall
  44. p185a.cpp:56:1: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
  45. decltype(r2)& r6 = i; // r6 has the type int&
  46. ^~~~~~~~
  47. p185a.cpp:50:12: error: expected unqualified-id before '&&' token
  48. typedef int&& RRI;
  49. ^~
  50. p185a.cpp:51:6: error: cannot declare reference to 'LRI' {aka 'int&'}
  51. LRI& r1 = i; // r1 has the type int&
  52. ^~
  53. p185a.cpp:52:12: error: cannot declare reference to 'LRI' {aka 'int&'}
  54. const LRI& r2 = i; // r2 has the type int&
  55. ^~
  56. p185a.cpp:53:10: error: expected unqualified-id before '&&' token
  57. const LRI&& r3 = i; // r3 has the type int&
  58. ^~
  59. p185a.cpp:54:1: error: 'RRI' does not name a type; did you mean 'LRI'?
  60. RRI& r4 = i; // r4 has the type int&
  61. ^~~
  62. LRI
  63. p185a.cpp:55:1: error: 'RRI' does not name a type; did you mean 'LRI'?
  64. RRI&& r5 = 5; // r5 has the type int&&
  65. ^~~
  66. LRI
  67. p185a.cpp:56:9: error: expected constructor, destructor, or type conversion before '(' token
  68. decltype(r2)& r6 = i; // r6 has the type int&
  69. ^
  70. p185a.cpp:57:9: error: expected constructor, destructor, or type conversion before '(' token
  71. decltype(r2)&& r7 = i; // r7 has the type int&
  72. ^
  73. p185a.cpp: In function 'int main()':
  74. p185a.cpp:63:29: error: 'r3' was not declared in this scope
  75. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  76. ^~
  77. p185a.cpp:63:29: note: suggested alternative: 'r2'
  78. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  79. ^~
  80. r2
  81. p185a.cpp:63:38: error: 'r4' was not declared in this scope
  82. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  83. ^~
  84. p185a.cpp:63:38: note: suggested alternative: 'r2'
  85. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  86. ^~
  87. r2
  88. p185a.cpp:63:47: error: 'r5' was not declared in this scope
  89. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  90. ^~
  91. p185a.cpp:63:47: note: suggested alternative: 'r2'
  92. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  93. ^~
  94. r2
  95. p185a.cpp:63:56: error: 'r6' was not declared in this scope
  96. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  97. ^~
  98. p185a.cpp:63:56: note: suggested alternative: 'r2'
  99. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  100. ^~
  101. r2
  102. p185a.cpp:63:65: error: 'r7' was not declared in this scope
  103. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  104. ^~
  105. p185a.cpp:63:65: note: suggested alternative: 'r2'
  106. cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
  107. ^~
  108. r2
  109.  
  110. $ g++-8 p185a.cpp -std=c++2a -Wall
  111. f(0)
  112. k()h(q)
  113. 0 0 0 0 5 0 0
  114. C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
Add Comment
Please, Sign In to add comment