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

            Bug ID: 29036
           Summary: Confusing error message when converting an overloaded
                    function to std::function
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: roman.perepeli...@gmail.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Code:

#include <functional>

void F();
void F(int);

std::function<void()> f = F;

Error:

6: error: no viable conversion from '<overloaded function type>' to
'std::function<void ()>'
  std::function<void()> f = &F;
                        ^   ~~
[...]
functional:2192:7: note: candidate constructor not viable: no overload of 'F'
matching 'const std::function<void ()> &' for 1st argument
      function(const function& __x);
      ^
[...]

This statement is confusing: "no overload of 'F' matching 'const
std::function<void ()> &'". It's easy to misinterpret it as implying that the
compiler tried to convert every overload of 'F' to 'std::function<void ()>' and
failed.

-- 
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