[llvm] r202988 - Work around MSVC bug in IntrusiveRefCntPtr.h

Hans Wennborg hans at hanshq.net
Wed Mar 5 08:26:04 PST 2014


Author: hans
Date: Wed Mar  5 10:26:04 2014
New Revision: 202988

URL: http://llvm.org/viewvc/llvm-project?rev=202988&view=rev
Log:
Work around MSVC bug in IntrusiveRefCntPtr.h

The build was failing with:

  error C2664: 'std::atomic_int::atomic_int(const std::atomic_int &)' : cannot convert argument 1 from 'int' to 'const std::atomic_int &'

Apparently "std::atomic_int x(0)" doesn't work, but "std::atomic<int> x(0)"
does.

Modified:
    llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h

Modified: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=202988&r1=202987&r2=202988&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Wed Mar  5 10:26:04 2014
@@ -99,7 +99,7 @@ namespace llvm {
 /// management of reference counts.
 template <class Derived>
 class ThreadSafeRefCountedBase {
-  mutable std::atomic_int RefCount;
+  mutable std::atomic<int> RefCount;
 
 protected:
   ThreadSafeRefCountedBase() : RefCount(0) {}





More information about the llvm-commits mailing list