From a18d133de4112a931efd1ad7e5a68f2ae2e3c2d2 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Thu, 3 Nov 2016 21:19:25 +0100
Subject: [PATCH] First round of fixing Clang compiler and linker problems

---
 DDCond/include/DDCond/ConditionsManager.h |  7 +++-
 DDCond/src/ConditionsManager.cpp          |  4 --
 DDCore/include/DD4hep/ConditionDerived.h  |  3 +-
 DDCore/include/DD4hep/IOV.h               |  4 +-
 DDCore/include/DD4hep/LCDDHelper.h        | 15 ++++---
 DDCore/include/DD4hep/Operators.h         |  4 +-
 DDCore/include/DD4hep/Shapes.h            | 51 +++++++++++++++++++----
 DDCore/include/XML/XMLElements.h          |  4 ++
 DDCore/src/IOV.cpp                        |  5 ---
 DDG4/include/DDG4/Geant4PhysicsList.h     | 32 +++++++-------
 10 files changed, 84 insertions(+), 45 deletions(-)

diff --git a/DDCond/include/DDCond/ConditionsManager.h b/DDCond/include/DDCond/ConditionsManager.h
index 45e409a2a..8d664f777 100644
--- a/DDCond/include/DDCond/ConditionsManager.h
+++ b/DDCond/include/DDCond/ConditionsManager.h
@@ -71,7 +71,7 @@ namespace DD4hep {
       ConditionsManager(LCDD& lcdd);
 
       /// Default constructor
-      ConditionsManager() : Handle<Object>() {}
+      ConditionsManager() = default;
 
       /// Constructor to be used with valid pointer to object
       ConditionsManager(Object* p) : Handle<Object>(p) {}
@@ -83,8 +83,11 @@ namespace DD4hep {
       template <typename Q> ConditionsManager(const Handle<Q>& e) : Handle<Object>(e) {}
 
       /// Default destructor
-      ~ConditionsManager();
+      ~ConditionsManager() = default;
 
+      /// Assignment operator
+      ConditionsManager& operator=(const ConditionsManager& c) = default;
+      
       /// Initialize the object after having set the properties
       ConditionsManager& initialize();
 
diff --git a/DDCond/src/ConditionsManager.cpp b/DDCond/src/ConditionsManager.cpp
index 4418a8e82..580da8bba 100644
--- a/DDCond/src/ConditionsManager.cpp
+++ b/DDCond/src/ConditionsManager.cpp
@@ -43,10 +43,6 @@ ConditionsManager::ConditionsManager(LCDD& lcdd)  {
   assign(new Object(lcdd), "ConditionsManager","");
 }
  
-/// Default destructor
-ConditionsManager::~ConditionsManager()   {
-}
-
 ConditionsManager& ConditionsManager::initialize()   {
   access()->initialize();
   return *this;
diff --git a/DDCore/include/DD4hep/ConditionDerived.h b/DDCore/include/DD4hep/ConditionDerived.h
index e640f24d9..af5426159 100644
--- a/DDCore/include/DD4hep/ConditionDerived.h
+++ b/DDCore/include/DD4hep/ConditionDerived.h
@@ -60,7 +60,8 @@ namespace DD4hep {
      *  \version 1.0
      *  \ingroup DD4HEP_CONDITIONS
      */
-    struct ConditionUpdateContext  {
+    class ConditionUpdateContext  {
+    public:
       const ConditionResolver&   resolver;
       const ConditionDependency& dependency;
       Condition::iov_type*       iov;
diff --git a/DDCore/include/DD4hep/IOV.h b/DDCore/include/DD4hep/IOV.h
index 7acca979c..0edbc037e 100644
--- a/DDCore/include/DD4hep/IOV.h
+++ b/DDCore/include/DD4hep/IOV.h
@@ -59,7 +59,9 @@ namespace DD4hep {
   class IOV   {
   private:
     /// Initializing constructor: Does not set reference to IOVType !
-    explicit IOV();
+    explicit IOV() = delete;
+    /// Inhibit assignment
+    IOV& operator=(const IOV& c) = default;
   public:
     /// Key definition
     typedef long Key_first_type;
diff --git a/DDCore/include/DD4hep/LCDDHelper.h b/DDCore/include/DD4hep/LCDDHelper.h
index 0a50cfe4a..2558dc382 100644
--- a/DDCore/include/DD4hep/LCDDHelper.h
+++ b/DDCore/include/DD4hep/LCDDHelper.h
@@ -18,7 +18,6 @@
 /// Namespace for the AIDA detector description toolkit
 namespace DD4hep {
 
-
   /// Namespace for the geometry part of the AIDA detector description toolkit
   namespace Geometry {
 
@@ -35,15 +34,19 @@ namespace DD4hep {
     class LCDDHelper : public Handle<LCDD>  {
     public:
       /// Default constructor
-      explicit LCDDHelper() : handle_t() {}
+      LCDDHelper() = default;
+      /// Copy constructor
+      LCDDHelper(const LCDDHelper& h) = default;
       /// Initializing constructor from pointer
-      explicit LCDDHelper(LCDD* lcdd_ptr) : handle_t(lcdd_ptr) {}
+      LCDDHelper(LCDD* lcdd_ptr) : handle_t(lcdd_ptr) {}
       /// Initializing constructor from pointer
-      explicit LCDDHelper(LCDD& lcdd_ref) : handle_t(&lcdd_ref) {}
+      LCDDHelper(LCDD& lcdd_ref) : handle_t(&lcdd_ref) {}
       /// Copy constructor
-      explicit LCDDHelper(const handle_t& h) : handle_t(h) {}
+      LCDDHelper(const handle_t& h) : handle_t(h) {}
       /// Default destructor
-      ~LCDDHelper() {}
+      ~LCDDHelper() = default;
+      /// Assignment operator
+      LCDDHelper& operator=(const LCDDHelper& c) = default;
       /// Access the sensitive detector of a given subdetector (if the sub-detector is sensitive!)
       SensitiveDetector sensitiveDetector(const std::string& detector) const;
       /// Given a detector element, access it's sensitive detector (if the sub-detector is sensitive!)
diff --git a/DDCore/include/DD4hep/Operators.h b/DDCore/include/DD4hep/Operators.h
index 67e8b05c3..94357a7c1 100644
--- a/DDCore/include/DD4hep/Operators.h
+++ b/DDCore/include/DD4hep/Operators.h
@@ -24,7 +24,7 @@ namespace DD4hep {
   template <typename T> class ByName {
   private:
     /// Assignment operator
-    template <typename Q> ByName<T>& operator=(const ByName<Q>& copy)  { return *this; }
+    template <typename Q> ByName<T>& operator=(const ByName<Q>& /* copy */)  { return *this; }
   public:
     /// Reference name
     const std::string& name;
@@ -45,7 +45,7 @@ namespace DD4hep {
   template <typename T> class ByNameAttr {
   private:
     /// Assignment operator
-    template <typename Q> ByNameAttr<T>& operator=(const ByNameAttr<Q>& copy)  { return *this; }
+    template <typename Q> ByNameAttr<T>& operator=(const ByNameAttr<Q>& /* copy */)  { return *this; }
   public:
     /// Reference name
     const std::string& name;
diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h
index da1752ebd..f416c4a34 100644
--- a/DDCore/include/DD4hep/Shapes.h
+++ b/DDCore/include/DD4hep/Shapes.h
@@ -85,6 +85,9 @@ namespace DD4hep {
       Solid_type(const Handle<T>& e) : Handle<T>(e) {  }
       /// Constructor to be used when passing an already created object: need to check pointers
       template <typename Q> Solid_type(const Handle<Q>& e) : Handle<T>(e) {  }
+      /// Assignment operator
+      Solid_type& operator=(const Solid_type& copy) = default;
+
       /// Access to shape name
       const char* name() const;
       /// Auto conversion to underlying ROOT object
@@ -127,14 +130,14 @@ namespace DD4hep {
       /// Constructor to be used with an existing object
       template <typename Q> Box(const Handle<Q>& e) : Solid_type<TGeoBBox>(e) { }
       /// Constructor to create an anonymous new box object (retrieves name from volume)
-      Box(double x_val, double y_val, double z_val) {
-        make(x_val, y_val, z_val);
-      }
+      Box(double x_val, double y_val, double z_val) {  make(x_val, y_val, z_val);  }
       /// Constructor to create an anonymous new box object (retrieves name from volume)
       template <typename X, typename Y, typename Z>
-      Box(const X& x_val, const Y& y_val, const Z& z_val) {
+      Box(const X& x_val, const Y& y_val, const Z& z_val)  {
         make(_toDouble(x_val), _toDouble(y_val), _toDouble(z_val));
       }
+      /// Assignment operator
+      Box& operator=(const Box& copy) = default;
       /// Set the box dimensions
       Box& setDimensions(double x_val, double y_val, double z_val);
       /// Access half "length" of the box
@@ -170,9 +173,9 @@ namespace DD4hep {
       /// Constructor to be used with an existing object
       template <typename Q> HalfSpace(const Handle<Q>& e) : Solid_type<TGeoHalfSpace>(e) { }
       /// Constructor to create an new halfspace object from a point on a plane and the plane normal
-      HalfSpace(const double* const point, const double* const normal) {
-        make(point,normal);
-      }
+      HalfSpace(const double* const point, const double* const normal) { make(point,normal);  }
+      /// Assignment operator
+      HalfSpace& operator=(const HalfSpace& copy) = default;
     };
 
     /// Class describing a Polycone shape
@@ -209,6 +212,8 @@ namespace DD4hep {
       /// Constructor to create a new polycone object. Add at the same time all Z planes
       Polycone(double start, double delta, const std::vector<double>& rmin, const std::vector<double>& rmax,
                const std::vector<double>& z);
+      /// Assignment operator
+      Polycone& operator=(const Polycone& copy) = default;
 
       /// Add Z-planes to the Polycone
       void addZPlanes(const std::vector<double>& rmin, const std::vector<double>& rmax, const std::vector<double>& z);
@@ -238,6 +243,8 @@ namespace DD4hep {
       template <typename Q> ConeSegment(const Handle<Q>& e) : Solid_type<TGeoConeSeg>(e) {  }
       /// Constructor to create a new ConeSegment object
       ConeSegment(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1 = 0.0, double phi2 = 2.0 * M_PI);
+      /// Assignment operator
+      ConeSegment& operator=(const ConeSegment& copy) = default;
 
       /// Set the cone segment dimensions
       ConeSegment& setDimensions(double dz, double rmin1, double rmax1,
@@ -298,6 +305,8 @@ namespace DD4hep {
       template <typename RMIN, typename RMAX, typename Z, typename DELTAPHI>
       Tube(const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi)
       {  make("", _toDouble(rmin), _toDouble(rmax), _toDouble(z), 0, _toDouble(deltaPhi));   }
+      /// Assignment operator
+      Tube& operator=(const Tube& copy) = default;
       /// Set the tube dimensions
       Tube& setDimensions(double rmin, double rmax, double z, double startPhi=0.0, double deltaPhi=2*M_PI);
     };
@@ -334,6 +343,8 @@ namespace DD4hep {
       template <typename A, typename B, typename DZ>
       EllipticalTube(const A& a, const B& b, const DZ& dz)
       {  make(_toDouble(a), _toDouble(b), _toDouble(dz));   }
+      /// Assignment operator
+      EllipticalTube& operator=(const EllipticalTube& copy) = default;
       /// Set the tube dimensions
       EllipticalTube& setDimensions(double a, double b, double dz);
     };
@@ -366,6 +377,8 @@ namespace DD4hep {
       template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2>
       Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2)
       {     make(_toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); }
+      /// Assignment operator
+      Cone& operator=(const Cone& copy) = default;
       /// Set the box dimensions
       Cone& setDimensions(double z, double rmin1, double rmax1, double rmin2, double rmax2);
     };
@@ -401,6 +414,8 @@ namespace DD4hep {
       /// Constructor to create a new anonymous object with attribute initialization
       template <typename PZ,typename PY,typename PX,typename PLTX> Trap(PZ pz, PY py, PX px, PLTX pLTX)
       { make(_toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); }
+      /// Assignment operator
+      Trap& operator=(const Trap& copy) = default;
       /// Set the trap dimensions
       Trap& setDimensions(double z, double theta, double phi, 
                           double y1, double x1, double x2, double alpha1, 
@@ -437,6 +452,8 @@ namespace DD4hep {
       template <typename X1,typename X2,typename Y1,typename Y2,typename Z>
       Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z)
       { make(_toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); }
+      /// Assignment operator
+      Trapezoid& operator=(const Trapezoid& copy) = default;
       /// Set the Trapezoid dimensions
       Trapezoid& setDimensions(double x1, double x2, double y1, double y2, double z);
     };
@@ -470,6 +487,8 @@ namespace DD4hep {
       /// Constructor to create a new anonymous object with attribute initialization
       Torus(double r, double rmin, double rmax, double phi=M_PI, double delta_phi = 2.*M_PI)
       {   make(r,rmin,rmax,phi,delta_phi);  }
+      /// Assignment operator
+      Torus& operator=(const Torus& copy) = default;
       /// Set the Torus dimensions
       Torus& setDimensions(double r, double rmin, double rmax, double phi, double delta_phi);
     };
@@ -496,6 +515,8 @@ namespace DD4hep {
       template <typename Q> Sphere(const Handle<Q>& e) : Solid_type<TGeoSphere>(e) {  }
       /// Constructor to create a new anonymous object with attribute initialization
       Sphere(double rmin, double rmax, double theta = 0., double delta_theta = M_PI, double phi = 0.0, double delta_phi = 2. * M_PI);
+      /// Assignment operator
+      Sphere& operator=(const Sphere& copy) = default;
       /// Set the Sphere dimensions
       Sphere& setDimensions(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi);
     };
@@ -522,6 +543,8 @@ namespace DD4hep {
       template <typename Q> Paraboloid(const Handle<Q>& e) : Solid_type<TGeoParaboloid>(e) { }
       /// Constructor to create a new anonymous object with attribute initialization
       Paraboloid(double r_low, double r_high, double delta_z);
+      /// Assignment operator
+      Paraboloid& operator=(const Paraboloid& copy) = default;
       /// Set the Paraboloid dimensions
       Paraboloid& setDimensions(double r_low, double r_high, double delta_z);
     };
@@ -548,6 +571,8 @@ namespace DD4hep {
       template <typename Q> Hyperboloid(const Handle<Q>& e) : Solid_type<TGeoHype>(e) {   }
       /// Constructor to create a new anonymous object with attribute initialization
       Hyperboloid(double rin, double stin, double rout, double stout, double dz);
+      /// Assignment operator
+      Hyperboloid& operator=(const Hyperboloid& copy) = default;
       /// Set the Hyperboloid dimensions
       Hyperboloid& setDimensions(double rin, double stin, double rout, double stout, double dz);
     };
@@ -580,6 +605,8 @@ namespace DD4hep {
       PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]);
       /// Constructor to create a new object with phi_start, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2
       PolyhedraRegular(int nsides, double phi_start, double rmin, double rmax, double zlen);
+      /// Assignment operator
+      PolyhedraRegular& operator=(const PolyhedraRegular& copy) = default;
     };
 
     /// Class describing an arbitray solid defined by 8 vertices.
@@ -606,6 +633,8 @@ namespace DD4hep {
       template <typename Q> EightPointSolid(const Handle<Q>& e) : Solid_type<TGeoArb8>(e) {}
       /// Constructor to create a new anonymous object with attribute initialization
       EightPointSolid(double dz, const double* vertices) { make(dz,vertices);  }
+      /// Assignment operator
+      EightPointSolid& operator=(const EightPointSolid& copy) = default;
     };
 
     /// Base class describing boolean (=union,intersection,subtraction) solids
@@ -628,6 +657,8 @@ namespace DD4hep {
       /// Constructor to be used when passing an already created object
       template <typename Q>
       BooleanSolid(const Handle<Q>& e) : Solid_type<TGeoCompositeShape>(e) { }
+      /// Assignment operator
+      BooleanSolid& operator=(const BooleanSolid& copy) = default;
     };
 
     /// Class describing boolean subtraction solid
@@ -658,6 +689,8 @@ namespace DD4hep {
       SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot);
       /// Constructor to create a new object. Placement by a generic transformation within the mother
       SubtractionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos);
+      /// Assignment operator
+      SubtractionSolid& operator=(const SubtractionSolid& copy) = default;
     };
 
     /// Class describing boolean union solid
@@ -688,6 +721,8 @@ namespace DD4hep {
       UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot);
       /// Constructor to create a new object. Placement by a generic transformation within the mother
       UnionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos);
+      /// Assignment operator
+      UnionSolid& operator=(const UnionSolid& copy) = default;
     };
 
     /// Class describing boolean intersection solid
@@ -718,6 +753,8 @@ namespace DD4hep {
       IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot);
       /// Constructor to create a new object. Placement by a generic transformation within the mother
       IntersectionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos);
+      /// Assignment operator
+      IntersectionSolid& operator=(const IntersectionSolid& copy) = default;
     };
 
   } /* End namespace Geometry           */
diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h
index 5bd36037c..7f0c546e0 100644
--- a/DDCore/include/XML/XMLElements.h
+++ b/DDCore/include/XML/XMLElements.h
@@ -269,6 +269,10 @@ namespace DD4hep {
         : Strng_t(s), m_str(s) {
         register_func(v, this);
       }
+      /// Copy constructor
+      Tag_t(const Tag_t& c)
+        : Strng_t(c), m_str(c.m_str) {
+      }
       /// Destructor
       ~Tag_t() {
       }
diff --git a/DDCore/src/IOV.cpp b/DDCore/src/IOV.cpp
index 39e801d9a..fc443662d 100644
--- a/DDCore/src/IOV.cpp
+++ b/DDCore/src/IOV.cpp
@@ -39,11 +39,6 @@ std::string IOVType::str()  const   {
   return text;
 }
 
-/// Initializing constructor: Does not set reference to IOVType !
-IOV::IOV() : iovType(0), keyData(0,0), optData(0)  {
-  type = int(IOVType::UNKNOWN_IOV);
-}
-
 /// Initializing constructor
 IOV::IOV(const IOVType* t) : iovType(t), keyData(0,0), optData(0)  {
   type = t ? t->type : int(IOVType::UNKNOWN_IOV);
diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h
index b0f5e0acf..b52ce0514 100644
--- a/DDG4/include/DDG4/Geant4PhysicsList.h
+++ b/DDG4/include/DDG4/Geant4PhysicsList.h
@@ -69,15 +69,15 @@ namespace DD4hep {
       class ParticleConstructor: public std::string {
       public:
         /// Default constructor
-        ParticleConstructor()
-          : std::string() {
-        }
+        ParticleConstructor() = default;
         /// Initalizing constructor
-        ParticleConstructor(const std::string& s)
-          : std::string(s) {
-        }
+        ParticleConstructor(const std::string& s) : std::string(s) { }
         /// Default destructor
-        ~ParticleConstructor() {
+        ~ParticleConstructor() {}
+        /// Assignment operator
+        ParticleConstructor& operator=(const ParticleConstructor& c)  {
+          if ( &c != this ) this->std::string::operator=(c);
+          return *this;
         }
       };
       typedef std::vector<ParticleConstructor> ParticleConstructors;
@@ -94,19 +94,17 @@ namespace DD4hep {
         G4VPhysicsConstructor* pointer;
       public:
         /// Default constructor
-        PhysicsConstructor()
-          : std::string(), pointer(0) {
-        }
+        PhysicsConstructor() : std::string(), pointer(0) {}
         /// Copy constructor
-        PhysicsConstructor(const PhysicsConstructor& c)
-          : std::string(c), pointer(c.pointer)  {
-        }
+        PhysicsConstructor(const PhysicsConstructor& c) : std::string(c), pointer(c.pointer)  {}
         /// Initalizing constructor
-        PhysicsConstructor(const std::string& s)
-          : std::string(s), pointer(0)  {
-        }
+        PhysicsConstructor(const std::string& s) : std::string(s), pointer(0)  {}
         /// Default destructor
-        ~PhysicsConstructor() {
+        ~PhysicsConstructor() {}
+        /// Assignment operator
+        PhysicsConstructor& operator=(const PhysicsConstructor& c)  {
+          if ( &c != this ) { this->std::string::operator=(c); pointer=c.pointer; }
+          return *this;
         }
       };
       typedef std::vector<PhysicsConstructor> PhysicsConstructors;
-- 
GitLab