How to use std::is_same to generate compile time errors?
<p>I am using a third party API, which includes a header file that contains a set of typedefs.  Over the past 4 years there have been minor changes to some of the typedefs (e.g. switching between unsigned/signed, changing from int to long etc).</p>

<p>I want to add a compile time check in my code so that I know if a specific typedef has changed.  I was thinking of adding something like the below:</p>

<pre><code>#if !std::is_same&lt;::ApiType, int&gt;::value
#error Type has changed
#endif
</code></pre>

<p>When I tried this out across various typedefs I found that a compile error was always being thrown.</p>

<p>I set up a small console program, which showed the same problem (i.e. always false for preprocessor usage) but was fine outside of the preprocessor:</p>

<pre><code>#include "stdafx.h"
#include &lt;Windows.h&gt;
#include &lt;type_traits&gt;

int main()
{
#if std::is_same&lt;int, int&gt;::value
  const auto aa = 14; // omitted
#else
  const auto bb = 17;
#endif

#if std::is_same&lt;::DWORD, int&gt;::value
  const auto cc = 14; // omitted
#else
  const auto dd = 17;
#endif

  const auto a = std::is_same&lt;int, int&gt;::value; // true
  const auto b = std::is_same&lt;::DWORD, int&gt;::value; // false
  const auto c = std::is_same&lt;::DWORD, unsigned long&gt;::value; // true

  return 0;
}
</code></pre>

<p>I am using Visual Studio 2015.</p>

<p>How do I implement such a compile time check on expected types (specifically to produce a compile time error if the types are not the same)?</p>