[llvm-bugs] [Bug 33230] New: Clang on Windows should define __STDCPP_THREADS__ to be 1

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 30 13:51:13 PDT 2017


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

            Bug ID: 33230
           Summary: Clang on Windows should define __STDCPP_THREADS__ to
                    be 1
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sfinae at hotmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18541
  --> https://bugs.llvm.org/attachment.cgi?id=18541&action=edit
Self-contained test case

C:\Temp>type meow.cpp
/***
N4659 19.8 [cpp.predefined]/2:
"The following macro names are conditionally defined by the implementation:
[...]
__STDCPP_THREADS__
Defined, and has the value integer literal 1, if and only if
a program can have more than one thread of execution (4.7)."
***/

#ifdef __STDCPP_THREADS__
    #if __STDCPP_THREADS__ == 1
        #include <stdio.h>
        int main() { puts("Success!"); }
    #else
        #error WOOF
    #endif
#else
    #error BOOM
#endif

C:\Temp>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25326 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Temp>cl /EHsc /nologo /W4 meow.cpp && meow
meow.cpp
Success!

C:\Temp>clang-cl -v
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: S:\WCFB01\vctools\NonShip\ClangLLVM\bin

C:\Temp>clang-cl /EHsc /nologo /W4 meow.cpp && meow
meow.cpp(17,6):  error: BOOM
    #error BOOM
     ^
1 error generated.

C:\Temp>clang-cl /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
meow.cpp(17,6):  error: BOOM
    #error BOOM
     ^
1 error generated.

-- 
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/20170530/9c2b3ff1/attachment.html>


More information about the llvm-bugs mailing list