title: how can I find where a C++ copy constructor is being USED via a compile error?
body: <p>In short: is there some way I can modify a class definition such that it fails to compile at <strong>the point of use</strong> of a copy constructor no matter where it's used?</p>
  
  <p>I have a very large project and was cleaning up some class definitions.  There's a class that I explicitly don't want to use copy constructors on (let's ignore why that is for the sake of this discussion), and in the interest of safety, I figured I'd just define the copy constructor as private and not actually implement it... that way it would throw a compile error if I tried to use it anywhere.  Lo and behold, it compiles fine, but I have a linker error... the copy constructor implementation is not found!  Presumably that means it's in use somewhere, but I'm unable to find where it's being used.  This is Visual Studio 2010 by the way.  So my question is, is there some way I can modify the class definition such that it fails to compile at the point of use?</p>
  
  <pre><code>class Sample {
  private:
      // not implemented
      Sample( const Sample&amp; rhs );
      Sample&amp; operator=( const Sample&amp; rhs );
  public:
      // implemented
      Sample();
  ...
  };
  
  Sample *samp1 = new Sample;
  Sample *samp2 = new Sample( *samp1 ); // &lt;&lt;-- inaccessible here!  this works
  </code></pre>
  
  <p>Presumably since I'm not hitting a compile error, but am hitting the linker error, that it means the class itself (or a friend) is doing the copy-constructed create (since that's all that would have access to the private constructor), but I sure can't find it!</p>