diff --git a/src/coreclr/gc/env/volatile.h b/src/coreclr/gc/env/volatile.h index c40e5c2d60964e..bd2d8df58d7c2b 100644 --- a/src/coreclr/gc/env/volatile.h +++ b/src/coreclr/gc/env/volatile.h @@ -469,6 +469,16 @@ class VolatilePtr : public Volatile
{ } + // + // Bring the base class operator= into scope. + // + using Volatile
::operator=;
+
+ //
+ // Copy assignment operator.
+ //
+ inline VolatilePtr
STATIC_CONTRACT_SUPPORTS_DAC;
}
+ //
+ // Bring the base class operator= into scope. Without this, the compiler-generated
+ // copy assignment operator hides Volatile ::operator= and performs a plain store,
+ // bypassing the memory barriers provided by VolatileStore.
+ //
+ using Volatile ::operator=;
+
+ //
+ // Copy assignment operator. The using declaration above does not suppress the
+ // compiler-generated copy assignment, so we must define it explicitly.
+ //
+ inline VolatilePtr