Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error, no return in non-void function #181

Open
susnux opened this issue Dec 6, 2021 · 1 comment
Open

Compile error, no return in non-void function #181

susnux opened this issue Dec 6, 2021 · 1 comment

Comments

@susnux
Copy link
Contributor

susnux commented Dec 6, 2021

Building on openSUSE Tumbleweeds results in this error for version 5.2.4:

[ 101s] In file included from /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/economy/resource_finder.cpp:29,
[ 101s] from /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/build/CMakeFiles/wyrmgus.dir/Unity/unity_economy_cxx.cxx:7:
[ 101s] /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/economy/resource_finder.h: In member function 'bool wyrmgus::find_resource_result::is_valid() const':
[ 101s] /home/abuild/rpmbuild/BUILD/Wyrmgus-5.2.4/src/economy/resource_finder.h:40:9: error: no return statement in function returning non-void [-Werror=return-type]
[ 101s] 40 | }
[ 101s] | ^

There is a missing return, so a possible patch for fixing this issue would be:

diff -Nur Wyrmgus-5.2.4/src/economy/resource_finder.h new/src/economy/resource_finder.h
--- Wyrmgus-5.2.4/src/economy/resource_finder.h 2021-11-17 15:34:51.000000000 +0100
+++ new/src/economy/resource_finder.h   2021-12-06 13:58:39.499619874 +0100
@@ -36,7 +36,7 @@
 {
        bool is_valid() const
        {
-               this->resource_pos != QPoint(-1, -1) || this->resource_unit != nullptr;
+               return this->resource_pos != QPoint(-1, -1) || this->resource_unit != nullptr;
        }
 
        QPoint resource_pos = QPoint(-1, -1);
@Andrettin
Copy link
Owner

Thank you! I've implemented the fix now:
6d71334

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants