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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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 ` paolo.carlini at oracle dot com
  2012-04-23  3:59 ` M8R-gt1qwe at mailinator dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-23  0:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-23 00:21:43 UTC ---
Are you *really* sure you are using current 4.8? I get:

paolo@poldo4:~/Work> g++ -std=c++11 -Wall -Wextra -Werror -pedantic 53078.C 
53078.C: In function ‘int main()’:
53078.C:1:19: error: variable ‘x’ set but not used
[-Werror=unused-but-set-variable]
 int main() { auto x = []{}; }
                   ^


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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: M8R-gt1qwe at mailinator dot com @ 2012-04-23  3:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

--- Comment #2 from M8R-gt1qwe at mailinator dot com 2012-04-23 03:58:52 UTC ---
Ooops. That will teach me to make sure I update before filing a bug :S I was
running 20120401. You can close this. It doesn't manifest on 20120422.


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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-23  9:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-23 09:30:18 UTC ---
Ok (4_7-branch is also fine)


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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: mattipee at yahoo dot co.uk @ 2012-04-24  8:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

mattipee at yahoo dot co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mattipee at yahoo dot co.uk

--- Comment #4 from mattipee at yahoo dot co.uk 2012-04-24 08:34:17 UTC ---
Duplicate of Bug 52845


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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-24  9:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2012-04-24
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com
         Resolution|WORKSFORME                  |
     Ever Confirmed|0                           |1

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-24 09:28:33 UTC ---
Re-open..


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

* [Bug c++/53078] [C++11] Wrong diagnostic "no return statement in function returning non-void" on lambdas
  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
                   ` (4 preceding siblings ...)
  2012-04-24  9:29 ` paolo.carlini at oracle dot com
@ 2012-04-24  9:32 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-24  9:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53078

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-24 09:29:09 UTC ---
... to close as duplicate.

*** This bug has been marked as a duplicate of bug 52845 ***


^ 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).