[LLVMbugs] [Bug 23733] New: [Windows] Clang doesn't support std::atomic<function pointer> with Microsoft's STL

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 2 08:01:02 PDT 2015


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

            Bug ID: 23733
           Summary: [Windows] Clang doesn't support std::atomic<function
                    pointer> with Microsoft's STL
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sebastian.redl at getdesigned.at
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This code doesn't work with clang-cl for Visual Studio 2013:

void test() {
  std::atomic<void (*)()> fptr(nullptr);
  fptr.load();
}

The problem is that in atomic's implementation, all pointer atomics (which
includes pointer-to-function atomics) store a void* internally, and load()
static_casts the void* to the actual pointer type. Apparently, Microsoft's
compiler accepts a static_cast<void (*)()>((void*)0). clang-cl does not.

-- 
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/20150602/5eb2d421/attachment.html>


More information about the llvm-bugs mailing list