https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80801
Bug ID: 80801 Summary: Error "void value not ignored as it ought to be" is a bit cryptic Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gcc at martinien dot de Target Milestone: --- This code returns a not-very-intuitive error: $ cat void.cpp void func() { } int main() { return func(); } $ g++ -c void.cpp void.cpp: In function 'int main()': void.cpp:7:15: error: void value not ignored as it ought to be return func(); ^ In this small example it is clear, for complex code it might not be obvious what the error is. clang is a little bit more helpful: void.cpp:7:10: error: cannot initialize return object of type 'int' with an rvalue of type 'void' return func(); ^~~~~~ 1 error generated. Best regards, Martin