<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Super confusing diag when overload prevents template argument inference"
   href="https://bugs.llvm.org/show_bug.cgi?id=39561">39561</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Super confusing diag when overload prevents template argument inference
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Someone asked me why this doesn't build:

$ cat parallel_merge_sort.cpp 
#include <thread>
void mergesort(void *records, int start, int end, int threads) {
  std::thread lthread(mergesort, records, start, end, threads);
};


$ clang++ -std=c++11 -c parallel_merge_sort.cpp 
parallel_merge_sort.cpp:3:15: error: no matching constructor for initialization
of 'std::thread'
  std::thread lthread(mergesort, records, start, end, threads);
              ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/thread:353:9:
note: candidate template ignored: couldn't infer template argument '_Fp'
thread::thread(_Fp&& __f, _Args&&... __args)
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/thread:286:5:
note: candidate constructor not viable: requires 1 argument, but 5 were
provided
    thread(const thread&);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/thread:309:5:
note: candidate constructor not viable: requires single argument '__t', but 5
arguments were provided
    thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/thread:293:5:
note: candidate constructor not viable: requires 0 arguments, but 5 were
provided
    thread() _NOEXCEPT : __t_(0) {}
    ^
1 error generated.


It builds fine on Windows, on Linux with libc++ and libstd++, but doesn't build
on macOS or on the BSDs.


The reason is that BSD has a function named "mergesort" in its C standard
library, which makes inference of the first thread ctor candidate fail. Our
diagnostic here could be much better.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>