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

             Bug #: 52845
           Summary: non-void return type deduced for lambda with empty
                    compound statement
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: matti...@yahoo.co.uk


Below is output from "gcc -v", compilation line with warning and contents of
*.ii file.

user@host:~/$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-svn/configure : (reconfigured) ../gcc-svn/configure :
(reconfigured) ../gcc-svn/configure
--enable-languages=c,c++,fortran,java,lto,objc --no-create --no-recursion :
(reconfigured) ../gcc-svn/configure --enable-languages=c++ : (reconfigured)
../gcc-svn/configure --enable-languages=c,c++,lto --no-create --no-recursion
Thread model: posix
gcc version 4.8.0 20120401 (experimental) (GCC) 
user@host:~/$ g++ -save-temps -Wall --std=c++11 -c empty_lambda.cpp
empty_lambda.cpp: In lambda function:
empty_lambda.cpp:3:8: warning: no return statement in function returning
non-void [-Wreturn-type]
user@host:~/$ cat empty_lambda.ii
# 1 "empty_lambda.cpp"
# 1 "<command-line>"
# 1 "empty_lambda.cpp"
void f()
{
  [](){};
}
user@host:~/$ 

No warning with "gcc version 4.8.0 20120307 (experimental) (GCC)".

Reply via email to