http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078
Bug #: 53078 Summary: [C++11] Wrong diagnostic "no return statement in function returning non-void" on Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: m8r-gt1...@mailinator.com GCC erroneously warns about a missing return in lambdas where the return type is to be deduced as void. Example: $ cat a.c++ int main() { auto x = []{}; } $ g++-4.8 -std=c++11 -Wall -Wextra -Werror -pedantic a.c++ a.c++: In lambda function: a.c++:1:30: error: no return statement in function returning non-void [-Werror=return-type] cc1plus: all warnings being treated as errors $ Neither of the following alternatives produces this diagnostic: int main() { auto x = []{ return; }; } int main() { auto x = []() -> void {}; }