[LLVMbugs] [Bug 23047] New: improve error when binding to wrong placeholder

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Mar 27 14:51:04 PDT 2015


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

            Bug ID: 23047
           Summary: improve error when binding to wrong placeholder
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

We should product a nice error message for this mistake:

#include <functional>
#include <string>

void Print(const std::string& a, const std::string& b, const std::string& c);

void test() {
  std::function<void(const std::string&)> func =
      std::bind(&Print, "aaa", std::placeholders::_2, "ccc");
  func("garbage");
}

I'm not going to paste the template spew we get with libstdc++ today. I don't
know what we get with libc++.

What I want is an error message along the lines of "tried to use _2 placeholder
for a 1 argument function type". I'm not sure whether this should be strictly
in the compiler, or whether we can have collusion with the library
implementation.

-- 
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/20150327/cf9774b0/attachment.html>


More information about the llvm-bugs mailing list