@@ -236,17 +236,21 @@ TEST(RNTupleEvolution, Enum)
236236
237237TEST (RNTupleEvolution, CheckAtomic)
238238{
239-    //  TODO(jblomer): enable test with  CustomAtomicNotLockFree once linking of libatomic is sorted out. 
239+    EXPECT_FALSE (std::atomic< CustomAtomicNotLockFree>{}. is_lock_free ()); 
240240
241241   FileRaii fileGuard (" test_ntuple_evolution_check_atomic.root" 
242242   {
243243      auto  model = ROOT::RNTupleModel::Create ();
244244      auto  atomicInt = model->MakeField <std::atomic<std::int32_t >>(" atomicInt" 
245245      auto  regularInt = model->MakeField <std::int32_t >(" regularInt" 
246+       auto  atomicClass = model->MakeField <std::atomic<CustomAtomicNotLockFree>>(" atomicClass" 
247+       auto  regularClass = model->MakeField <CustomAtomicNotLockFree>(" regularClass" 
246248      auto  writer = ROOT::RNTupleWriter::Recreate (std::move (model), " ntpl" GetPath ());
247249
248250      *atomicInt = 7 ;
249251      *regularInt = 13 ;
252+       std::fill (std::begin (regularClass->a ), std::end (regularClass->a ), 137 );
253+       *atomicClass = *regularClass;
250254      writer->Fill ();
251255   }
252256
@@ -256,6 +260,9 @@ TEST(RNTupleEvolution, CheckAtomic)
256260   auto  v2 = reader->GetView <std::atomic<std::int64_t >>(" regularInt" 
257261   auto  v3 = reader->GetView <std::int64_t >(" atomicInt" 
258262
263+    auto  v4 = reader->GetView <CustomAtomicNotLockFree>(" atomicClass" 
264+    auto  v5 = reader->GetView <std::atomic<CustomAtomicNotLockFree>>(" regularClass" 
265+ 
259266   try  {
260267      reader->GetView <std::atomic<std::byte>>(" atomicInt" 
261268      FAIL () << " automatic evolution into an invalid atomic inner type should fail" 
@@ -273,6 +280,12 @@ TEST(RNTupleEvolution, CheckAtomic)
273280   EXPECT_EQ (7 , v1 (0 ));
274281   EXPECT_EQ (13 , v2 (0 ));
275282   EXPECT_EQ (7 , v3 (0 ));
283+ 
284+    EXPECT_EQ (137 , v4 (0 ).a [0 ]);
285+    EXPECT_EQ (137 , v4 (0 ).a [99 ]);
286+    CustomAtomicNotLockFree tmp = v5 (0 );
287+    EXPECT_EQ (137 , tmp.a [0 ]);
288+    EXPECT_EQ (137 , tmp.a [99 ]);
276289}
277290
278291TEST (RNTupleEvolution, ArrayAsRVec)
0 commit comments