title: Does there exist a static_warning?
body: <p>I'm aware of <a href="https://stackoverflow.com/questions/6128293/boost-static-warning">this question</a> which mentions Boost's "STATIC WARNING", but I'd like to ask again, specifically, how I could implement a <code>static_warning</code> which operates similarly to <code>static_assert</code> but only emits a <em>warning</em> at compile time rather than an aborting compilation error.</p>
  
  <p>I'd like something similar to Alexandrescu's proposal for a static assert in pre-C++11 days which somehow managed to print some useful contextual information as part of the error.</p>
  
  <p>It would be acceptable to require that the user enable certain standard compiler warnings in order for this construction to work (perhaps "invalid pointer conversion" or "breaks strict aliasing rules") -- any warning that should be part of a normal compilation anyway can be used.</p>
  
  <p>In short, I want <code>static_warning(false, "Hello world");</code> to create a compiler warning that should somehow include the string "hello world" in the warning message. Is this possible, say in GCC and MSVC, and how?</p>
  
  <p>I'd happily give out a small reward bounty for any particularly clever solution.</p>
  
  <hr>
  
  <p>As a bit of explanation: I got the idea when thinking about <a href="https://stackoverflow.com/q/8935705/596781">this question</a>: A static warning would be a useful way to trace through the compile-time process of complex template specializations, which are otherwise fairly hard to debug. A static warning could be used as a simple beacon for the compiler to emit "I'm now compiling this part of the code."</p>
  
  <hr>
  
  <p><strong>Update.</strong> Ideally, the warning would be triggered in the following setup:</p>
  
  <pre><code>template &lt;typename T&gt; struct Foo
  {
      static_warning(std::is_pointer&lt;T&gt;::value, "Attempting to use pointer type.");
      // ...
  };
  
  int main() { Foo&lt;int&gt; a; Foo&lt;int*&gt; b; }
  </code></pre>