[LLVMbugs] [Bug 22675] New: Clang For Windows With MSVC 2013 <thread> won't compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 24 09:06:50 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22675

            Bug ID: 22675
           Summary: Clang For Windows With MSVC 2013 <thread> won't
                    compile
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: james.baker at bullochtech.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20150224/125196d7/attachment.html>


More information about the llvm-bugs mailing list