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: unassignedclangb...@nondot.org
          Reporter: blastr...@free.fr
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to