diff --git a/src/colvar/ERMSD.cpp b/src/colvar/ERMSD.cpp
index f28ce5d3de6b0fee99eb43e0373dbc4421cf866e..29ce5de51079e11a5f52c68bf095164aafad436b 100644
--- a/src/colvar/ERMSD.cpp
+++ b/src/colvar/ERMSD.cpp
@@ -100,7 +100,7 @@ class ERMSD : public Colvar {
      bool pbc;
 
 public:
-  ERMSD(const ActionOptions&);
+  explicit ERMSD(const ActionOptions&);
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
diff --git a/src/core/Atoms.h b/src/core/Atoms.h
index c308e4be99b55921eafdf7d410ff79ac7b23669f..4e7ed103d5c12357cc92a8cf931193dfd1e92314 100644
--- a/src/core/Atoms.h
+++ b/src/core/Atoms.h
@@ -119,7 +119,7 @@ class Atoms
     std::vector<double> positionsToBeReceived;
     std::vector<int>    indexToBeSent;
     std::vector<int>    indexToBeReceived;
-    operator bool(){return on;}
+    operator bool() const{return on;}
     DomainDecomposition():
       on(false), async(false)
       {}
diff --git a/src/tools/ERMSD.cpp b/src/tools/ERMSD.cpp
index 6e41d3a1af7c2d98469c7569b9b62e40a4fdfb53..398d6a5178f4994578771c0aef4cee563a21e29c 100644
--- a/src/tools/ERMSD.cpp
+++ b/src/tools/ERMSD.cpp
@@ -104,7 +104,6 @@ namespace PLMD{
           std::vector<Vector> centers;
           centers.resize(nresidues);
           
-          unsigned at_idx = 0;
           unsigned idx_deri = 0;
 
           Tensor da_dxa = (2./3.)*Tensor::identity();
@@ -123,7 +122,7 @@ namespace PLMD{
           for(unsigned res_idx=0;res_idx<natoms/3;res_idx++){
                
                
-               at_idx = 3*res_idx;
+               const unsigned at_idx = 3*res_idx;
                //center
                for (unsigned j=0;j<3;j++){
                     centers[res_idx] += w*positions[at_idx+j];
diff --git a/src/tools/FileBase.cpp b/src/tools/FileBase.cpp
index ff9263cd8f23fc3f015a50ddae4a21cf6b98bc13..4fc64aed69490208081be02d60bf2ff02cdf03dc 100644
--- a/src/tools/FileBase.cpp
+++ b/src/tools/FileBase.cpp
@@ -101,11 +101,10 @@ FileBase& FileBase::link(Action&action){
 }
 
 bool FileBase::FileExist(const std::string& path){
-  FILE *ff=NULL;
   bool do_exist=false;
   this->path=appendSuffix(path,getSuffix());
   mode="r";
-  ff=std::fopen(const_cast<char*>(this->path.c_str()),"r");
+  FILE *ff=std::fopen(const_cast<char*>(this->path.c_str()),"r");
   if(!ff){
     this->path=path;
     ff=std::fopen(const_cast<char*>(this->path.c_str()),"r");
diff --git a/src/tools/Grid.h b/src/tools/Grid.h
index e423e332ffe87147db93b3cc46f79ffd767ee221..165ee73671ea19842f7c42623e0758e71f1b6e34 100644
--- a/src/tools/Grid.h
+++ b/src/tools/Grid.h
@@ -209,7 +209,7 @@ public:
  Grid project( const std::vector<std::string> & proj , WeightBase *ptr2obj  ); 
  void projectOnLowDimension(double &val , std::vector<int> &varHigh, WeightBase* ptr2obj ); 
 /// set output format
- void setOutputFmt(std::string ss){fmt_=ss;}
+ void setOutputFmt(const std::string & ss){fmt_=ss;}
 /// Integrate the function calculated on the grid
  double integrate( std::vector<unsigned>& npoints );
 ///
diff --git a/src/tools/SwitchingFunction.cpp b/src/tools/SwitchingFunction.cpp
index d7a5826fd572f4add9afc4a4c7a5d0a8d9370a7f..fa685d1b0fd058b1366b2e6e832fb728bd337303 100644
--- a/src/tools/SwitchingFunction.cpp
+++ b/src/tools/SwitchingFunction.cpp
@@ -467,6 +467,36 @@ SwitchingFunction::SwitchingFunction(const SwitchingFunction&sf):
 #endif
 }
 
+SwitchingFunction & SwitchingFunction::operator=(const SwitchingFunction& sf){
+  if(&sf==this) return *this;
+  init=sf.init;
+  type=sf.type;
+  invr0=sf.invr0;
+  d0=sf.d0;
+  dmax=sf.dmax;
+  nn=sf.nn;
+  mm=sf.mm;
+  a=sf.a;
+  b=sf.b;
+  c=sf.c;
+  d=sf.d;
+  lambda=sf.lambda;
+  beta=sf.beta;
+  ref=sf.ref;
+  invr0_2=sf.invr0_2;
+  dmax_2=sf.dmax_2;
+  stretch=sf.stretch;
+  shift=sf.shift;
+  evaluator=NULL;
+  evaluator_deriv=NULL;
+#ifdef __PLUMED_HAS_MATHEVAL
+  if(sf.evaluator) evaluator=evaluator_create(evaluator_get_string(sf.evaluator));
+  if(sf.evaluator_deriv) evaluator_deriv=evaluator_create(evaluator_get_string(sf.evaluator_deriv));
+#endif
+  return *this;
+}
+
+
 void SwitchingFunction::set(int nn,int mm,double r0,double d0){
   init=true;
   type=rational;
diff --git a/src/tools/SwitchingFunction.h b/src/tools/SwitchingFunction.h
index 938bcb39bb5680de50e96223c9b6ea8400f6c2a8..4bcf27926a3cfb0663608184e2c8e1691fbae621 100644
--- a/src/tools/SwitchingFunction.h
+++ b/src/tools/SwitchingFunction.h
@@ -77,6 +77,8 @@ public:
   ~SwitchingFunction();
 /// Copy constructor
   SwitchingFunction(const SwitchingFunction&);
+/// Assignment operator
+  SwitchingFunction & operator=(const SwitchingFunction&);
 /// Set a "rational" switching function.
 /// Notice that a d_max is set automatically to a value such that
 /// f(d_max)=0.00001.