[llvm-bugs] [Bug 47012] New: __cpp_threadsafe_static_init is not defined

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 6 00:29:11 PDT 2020


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

            Bug ID: 47012
           Summary: __cpp_threadsafe_static_init is not defined
           Product: libc++
           Version: 9.0
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: noloader at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

It appears Clang does not define __cpp_threadsafe_static_init like it should.
__cpp_threadsafe_static_init signals dynamic initialization and destruction
with concurrency (N2660).

I'm working on OS X 10.12 using Apple's Command Line Tools. Apple's CLT
provides Clang 9:

  $ clang++ --version
  Apple LLVM version 9.0.0 (clang-900.0.39.2)
  Target: x86_64-apple-darwin16.7.0

The test program:

  $ cat TestPrograms/test_cxx11_dyninit.cxx
  int main(int argc, char* argv[])
  {
  #if __cpp_threadsafe_static_init >= 200806L
      int x[1];
  #else
      int x[-1];
  #endif
      return 0;
  }

$ clang++ -std=c++11 TestPrograms/test_cxx11_dyninit.cxx -o a.out
TestPrograms/test_cxx11_dyninit.cxx:7:11: error: 'x' declared as an array with
a
      negative size
    int x[-1];
          ^~
1 error generated.

Adding '-stdlib=libc++' does not help.

-- 
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/20200806/a7731652/attachment.html>


More information about the llvm-bugs mailing list