[llvm-bugs] [Bug 26725] New: Regression for assignment of generic zero-capture lambda expressions

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 24 06:12:49 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26725

            Bug ID: 26725
           Summary: Regression for assignment of generic zero-capture
                    lambda expressions
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: neil.semmel at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

>From clang 3.7 and onward, the following code will not compile:

#include <iostream>
int main( void ) {
    void (*func)(int) = [](auto a){ std::cout << a << std::endl; };
    func( 1 );
}

and errors with 

test.cpp:3:12: error: no viable conversion from '(lambda at test.cpp:3:25)' to
      'void (*)(int)'
    void (*func)(int) = [](auto a){ std::cout << a << std::endl; };
           ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:3:25: note: candidate template ignored: could not match 'void' against
      'void'
    void (*func)(int) = [](auto a){ std::cout << a << std::endl; };
                        ^
2 errors generated.

On clang 3.6 this compiles and executes as expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160224/e619ec77/attachment-0001.html>


More information about the llvm-bugs mailing list