diff --git a/src/coreclr/gc/env/volatile.h b/src/coreclr/gc/env/volatile.h index e1c014543139a0..21a83f9b682054 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