[llvm-bugs] [Bug 25989] New: can't cast an auto lambda with implicit void return type to function pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 1 03:11:19 PST 2016


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

            Bug ID: 25989
           Summary: can't cast an auto lambda with implicit void return
                    type to function pointer
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blastrock at free.fr
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Hi,

The following code used to compile with clang 3.6. It also works with VC++ 2015
and g++ 5.2.

  void (*f)(int) = [](auto){};

On clang 3.7, it fails with the following error:

  test.cpp:3:10: error: no viable conversion from '(lambda at test.cpp:3:20)'
to 'void (*)(int)'
    void (*f)(int) = [](auto){};
  test.cpp:3:20: note: candidate template ignored: could not match 'void'
against 'void'
    void (*f)(int) = [](auto){};

This code however does compile even with clang 3.7:

  void (*f)(int) = [](auto) -> auto {};

-- 
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/20160101/917a2582/attachment.html>


More information about the llvm-bugs mailing list