Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ ../cpla.sh p185a
- $ clang++ p185a.cpp -std=c++03 -Wall
- p185a.cpp:50:12: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
- typedef int&& RRI;
- ^
- p185a.cpp:52:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
- [-Wignored-qualifiers]
- const LRI& r2 = i; // r2 has the type int&
- ^~~~~~
- p185a.cpp:53:10: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
- const LRI&& r3 = i; // r3 has the type int&
- ^
- p185a.cpp:53:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
- [-Wignored-qualifiers]
- const LRI&& r3 = i; // r3 has the type int&
- ^~~~~~
- p185a.cpp:55:4: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
- RRI&& r5 = 5; // r5 has the type int&&
- ^
- p185a.cpp:57:13: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
- decltype(r2)&& r7 = i; // r7 has the type int&
- ^
- 6 warnings generated.
- f(0)
- k()h(q)
- 0 0 0 0 5 0 0
- C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
- $ clang++ p185a.cpp -std=c++2a -Wall
- p185a.cpp:52:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
- [-Wignored-qualifiers]
- const LRI& r2 = i; // r2 has the type int&
- ^~~~~~
- p185a.cpp:53:1: warning: 'const' qualifier on reference type 'LRI' (aka 'int &') has no effect
- [-Wignored-qualifiers]
- const LRI&& r3 = i; // r3 has the type int&
- ^~~~~~
- 2 warnings generated.
- f(0)
- k()h(q)
- 0 0 0 0 5 0 0
- C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
- $ g++-8 p185a.cpp -std=c++03 -Wall
- p185a.cpp:56:1: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
- decltype(r2)& r6 = i; // r6 has the type int&
- ^~~~~~~~
- p185a.cpp:50:12: error: expected unqualified-id before '&&' token
- typedef int&& RRI;
- ^~
- p185a.cpp:51:6: error: cannot declare reference to 'LRI' {aka 'int&'}
- LRI& r1 = i; // r1 has the type int&
- ^~
- p185a.cpp:52:12: error: cannot declare reference to 'LRI' {aka 'int&'}
- const LRI& r2 = i; // r2 has the type int&
- ^~
- p185a.cpp:53:10: error: expected unqualified-id before '&&' token
- const LRI&& r3 = i; // r3 has the type int&
- ^~
- p185a.cpp:54:1: error: 'RRI' does not name a type; did you mean 'LRI'?
- RRI& r4 = i; // r4 has the type int&
- ^~~
- LRI
- p185a.cpp:55:1: error: 'RRI' does not name a type; did you mean 'LRI'?
- RRI&& r5 = 5; // r5 has the type int&&
- ^~~
- LRI
- p185a.cpp:56:9: error: expected constructor, destructor, or type conversion before '(' token
- decltype(r2)& r6 = i; // r6 has the type int&
- ^
- p185a.cpp:57:9: error: expected constructor, destructor, or type conversion before '(' token
- decltype(r2)&& r7 = i; // r7 has the type int&
- ^
- p185a.cpp: In function 'int main()':
- p185a.cpp:63:29: error: 'r3' was not declared in this scope
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- p185a.cpp:63:29: note: suggested alternative: 'r2'
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- r2
- p185a.cpp:63:38: error: 'r4' was not declared in this scope
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- p185a.cpp:63:38: note: suggested alternative: 'r2'
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- r2
- p185a.cpp:63:47: error: 'r5' was not declared in this scope
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- p185a.cpp:63:47: note: suggested alternative: 'r2'
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- r2
- p185a.cpp:63:56: error: 'r6' was not declared in this scope
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- p185a.cpp:63:56: note: suggested alternative: 'r2'
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- r2
- p185a.cpp:63:65: error: 'r7' was not declared in this scope
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- p185a.cpp:63:65: note: suggested alternative: 'r2'
- cout << r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<r5<<" "<<r6<<" "<<r7<<endl;
- ^~
- r2
- $ g++-8 p185a.cpp -std=c++2a -Wall
- f(0)
- k()h(q)
- 0 0 0 0 5 0 0
- C++N4741(105)10.3.2 References [dcl.ref]p205a.cpp
Add Comment
Please, Sign In to add comment