title: How to unit test deliberate compilation errors of template code
body: <p><em>Please note that this is NOT a duplicate of <a href="https://stackoverflow.com/questions/4236635/how-write-a-unit-test-for-verifying-compiling-error">How write a unit test for verifying compiling error?</a> as I'm not concerned about testing the correctness of external libraries or the compiler itself.</em></p>
  
  <p>It is typical in C++, particularly when dealing with templates, to employ techniques that prevent some particular piece of code from being compiled. As these can get convoluted, what is the best way to ensure that particular pieces of code do indeed generate compiler errors?</p>
  
  <p>As the test shouldn't even get compiled, you can't rely on things such as <a href="/questions/tagged/boost-test" class="post-tag" title="show questions tagged &#39;boost-test&#39;" rel="tag">boost-test</a>, so I guess it should be integrated in the build system? How are these issues usually approached?</p>