From 4dacaab187efe36839cf872526cdac2f4180427d Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Fri, 13 Dec 2019 16:36:30 +0100 Subject: [PATCH 1/2] LArG4Barrel: Fix compilation with c++20. std::string == G4String is ambiguous with the new c++20 comparison rules. Explicirtly cast the G4String to std::string to fix this. --- .../LArG4/LArG4Barrel/src/PhysicalVolumeAccessor.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LArCalorimeter/LArG4/LArG4Barrel/src/PhysicalVolumeAccessor.cxx b/LArCalorimeter/LArG4/LArG4Barrel/src/PhysicalVolumeAccessor.cxx index 397f3d9a6d3f..41a9f28d5244 100644 --- a/LArCalorimeter/LArG4/LArG4Barrel/src/PhysicalVolumeAccessor.cxx +++ b/LArCalorimeter/LArG4/LArG4Barrel/src/PhysicalVolumeAccessor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "PhysicalVolumeAccessor.h" @@ -34,7 +34,7 @@ PhysicalVolumeAccessor::PhysicalVolumeAccessor(std::string name, for (int i=0;i<m_theLogicalVolume->GetNoDaughters();i++) { G4VPhysicalVolume *pv=m_theLogicalVolume->GetDaughter(i); - if (PVname==(pv->GetName())) + if (PVname == static_cast<const std::string&>(pv->GetName())) { m_thePhysicalVolumes[pv->GetCopyNo()]=pv; } @@ -60,7 +60,7 @@ void PhysicalVolumeAccessor::SetPhysicalVolumeList(std::string name) for (int i=0;i<m_theLogicalVolume->GetNoDaughters();i++) { G4VPhysicalVolume *pv=m_theLogicalVolume->GetDaughter(i); - if (name==(pv->GetName())) + if (name == static_cast<const std::string&>(pv->GetName())) { m_thePhysicalVolumes[pv->GetCopyNo()]=pv; } -- GitLab From f0189bf1e436b6614cd5d5e967bd07ec4e7a2184 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Fri, 13 Dec 2019 16:36:46 +0100 Subject: [PATCH 2/2] G4AtlasTools: Fix compilation with c++20. std::string == G4String is ambiguous with c++20's new comparison rules. Fix by casting the G4String to a std::string. --- Simulation/G4Atlas/G4AtlasTools/src/AddPhysicsDecayTool.cxx | 4 ++-- Simulation/G4Atlas/G4AtlasTools/src/RegionCreator.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Simulation/G4Atlas/G4AtlasTools/src/AddPhysicsDecayTool.cxx b/Simulation/G4Atlas/G4AtlasTools/src/AddPhysicsDecayTool.cxx index 0eb33e92413f..a9836a15b796 100644 --- a/Simulation/G4Atlas/G4AtlasTools/src/AddPhysicsDecayTool.cxx +++ b/Simulation/G4Atlas/G4AtlasTools/src/AddPhysicsDecayTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Include files @@ -76,7 +76,7 @@ void AddPhysicsDecayTool::ConstructProcess() while( (*PARTICLEITERATOR)() ) { G4ParticleDefinition *particle = PARTICLEITERATOR->value(); - if (m_ParticleName== particle->GetParticleName()) + if (m_ParticleName== static_cast<const std::string&>(particle->GetParticleName())) { G4DecayTable *table = particle->GetDecayTable(); diff --git a/Simulation/G4Atlas/G4AtlasTools/src/RegionCreator.cxx b/Simulation/G4Atlas/G4AtlasTools/src/RegionCreator.cxx index 960345faa16e..e7d7bb9ae1e2 100644 --- a/Simulation/G4Atlas/G4AtlasTools/src/RegionCreator.cxx +++ b/Simulation/G4Atlas/G4AtlasTools/src/RegionCreator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Base class @@ -49,7 +49,7 @@ StatusCode RegionCreator::initialize() for (auto* it: *logStore) { - if (vol==it->GetName()) + if (vol == static_cast<const std::string&>(it->GetName())) { nVolumes++; it->SetRegion(theRegion); -- GitLab