What is easiest way to force compiler to throw error?
<p><strong>To the folks marking this as duplicate</strong>: it is not; the other question addresses <code>enum</code>s which are compile-time constants. This is not a constant integral expression thus the solution would be very different. Please see my code below more carefully before suggesting this has already been answered in another question, as it has not in any way. I am checking the value of a member variable on an object, information created at runtime, and I'm curious what I can do with that in this context.</p>

<hr>

<p>I'm at a point where I need to use <em>something</em> to make the compiler fail if the user of my API does something she should not.</p>

<p>I don't know if that's possible, it is? The options I mention above are primarily run-time, right?</p>

<p>For example, suppose you have a function:</p>

<pre><code>   void doSomethingIncredible(AwesomeClass amazingObject)
    {
     //perform life-changing work here except:
     if (amazingObject.isntAmazing) //a bool property of object
        //uh oh, life sucks, I refuse to compile this
</code></pre>

<p>Now calling this function will change how you live your life in all respects, except for occasions in which <code>amazingObject</code> has a particular property switched on, for example, in which case, I want the compiler to not even allow this to pass, i.e. cannot run the program.</p>

<p>Somewhere in the body of the function is a c++ mechanism that forces compiling to fail, which alerts the user that you cannot use this function for such an inferior un-amazing object.</p>

<p>Is this possible?</p>

<p><strong>To clarify, this is something I want to do a compile time based the contents of a variable, as shown in my example above. The suggestion to use <code>static_assert</code> does not apply here.</strong></p>
