<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Clang For Windows With MSVC 2013 <thread> won't compile"
   href="http://llvm.org/bugs/show_bug.cgi?id=22675">22675</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang For Windows With MSVC 2013 <thread> won't compile
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows XP
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>james.baker@bullochtech.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>clang-cl won't compile anything that includes std::thread.

This code fails two different ways depending on if you use -D_HAS_EXCEPTIONS=0
or not.

    // threadtest.cpp
    #include <thread>
    #include <stdio.h>

    void threadDeleteObjectWorker(int i){
        printf("%i\n", i);
    }

    int main(int argc, char ** argv){
        std::thread t(threadDeleteObjectWorker, 3);
        t.join();
        return 0;
    }

If you compile like this: clang-cl -D_HAS_EXCEPTIONS=0  /c threadtest.cpp -o
threadtest.obj 


You get this:

    In file included from threadtest.cpp:1:
    In file included from C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\thread:16:
    C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\concrt.h(4774,22) :  error: use of undeclared identifier
'__uncaught_exception'; did you mean 'std::uncaught_exception'?
                    if (!__uncaught_exception())
                         ^
    C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\exception(311,44) :  note: 'std::uncaught_exception' declared
here
    _CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL uncaught_exception();        //
handle uncaught exception
                                               ^
    1 error generated.

If you compile like this: clang-cl /c threadtest.cpp -o threadtest.obj

You get this:

    In file included from threadtest.cpp:1:
    In file included from C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\thread:13:
    In file included from C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\functional:6:
    In file included from C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\xfunctional:7:
    C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\xstring(2214,3) :  error: cannot compile this try statement yet
                    _TRY_BEGIN
                    ^~~~~~~~~~
    C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\INCLUDE\xstddef(30,21) :  note: expanded from macro '_TRY_BEGIN'
     #define _TRY_BEGIN     try {
                            ^
    1 error generated.

It compiles properly using cl.</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>