Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1
- struct crap
- {
- int kek;
- void shit() {
- return kek;
- }
- };
- int main() {
- crap test;
- return 0;
- }
- $ clang++ main.cpp -> error: void function 'shit' should not return a value [-Wreturn-type]
- // 2
- template<typename T>
- struct crap
- {
- int kek;
- void shit() {
- return kek;
- }
- };
- int main() {
- crap<int> test;
- return 0;
- }
- $ clang++ main.cpp -> OK
- // 3
- template<typename T>
- struct crap
- {
- int kek;
- void shit() {
- return kek;
- }
- };
- int main() {
- crap<int> test;
- test.shit();
- return 0;
- }
- $ clang++ test.cpp
- test.cpp:6:3: error: void function 'shit' should not return a value [-Wreturn-type]
- return kek;
- ^ ~~~
- test.cpp:12:7: note: in instantiation of member function 'crap<int>::shit' requested here
- test.shit();
- ^
- 1 error generated.
- //4
- template<typename T>
- struct crap
- {
- void shit() {
- return 0;
- }
- };
- int main() {
- return 0;
- }
- $ clang++ test.cpp
- test.cpp:5:9: error: void function 'shit' should not return a value [-Wreturn-type]
- return 0;
- ^ ~
- 1 error generated.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement