public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53078] New: [C++11] Wrong diagnostic "no return statement in function returning non-void" on
@ 2012-04-22 23:28 M8R-gt1qwe at mailinator dot com
  2012-04-23  0:22 ` [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: M8R-gt1qwe at mailinator dot com @ 2012-04-22 23:28 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: M8R-gt1qwe@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 {}; }


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-24  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-22 23:28 [Bug c++/53078] New: [C++11] Wrong diagnostic "no return statement in function returning non-void" on M8R-gt1qwe at mailinator dot com
2012-04-23  0:22 ` [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas paolo.carlini at oracle dot com
2012-04-23  3:59 ` M8R-gt1qwe at mailinator dot com
2012-04-23  9:30 ` paolo.carlini at oracle dot com
2012-04-24  8:34 ` mattipee at yahoo dot co.uk
2012-04-24  9:29 ` paolo.carlini at oracle dot com
2012-04-24  9:32 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).