Any ideas on how to turn this into a warning?
<p>I'm using this is_enum function to check if a variable is an enum or not.
(See error below)</p>

<pre><code>#include &lt;boost/type_traits/is_enum.hpp&gt;
#include &lt;boost/static_assert.hpp&gt;

template&lt;typename T&gt;
void is_enum(T)
{
    BOOST_STATIC_ASSERT(boost::is_enum&lt;T&gt;::value == true);
}

int main()
{
    char c = 'a';
    is_enum(c);
    return 0;
}
</code></pre>

<p>This gives me the following error:</p>

<pre><code>-*- mode: compilation; default-directory: "/home/epronk/enums/" -*-
Compilation started at Thu Nov 10 21:20:05

g++ -I /home/epronk/src/boost_1_47_0/ q.cpp
q.cpp: In function ‘void is_enum(T) [with T = char]’:
q.cpp:13:   instantiated from here
q.cpp:7: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE&lt;false&gt;’ 
q.cpp:7: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE&lt;false&gt;’ 

Compilation exited abnormally with code 1 at Thu Nov 10 21:20:05
</code></pre>

<p>(not sure why g++ (Debian 4.4.5-8) 4.4.5 give me the same error twice)</p>

<p>Is it possible to change this function so it becomes a warning?</p>

<p>For a char you can try to assign 256 to it which results in a overflow error.</p>

<p>edited</p>

<p>Some context: I want to find switch statements like this one.</p>

<pre><code>#define switch(arg) \
is_enums(arg); \
switch(arg)

int main()
{
    char c = Red;

    switch(c)
    {
    case Banana: // No warning
        break;
    case Red:
        break;
    case Green:
        break;
    case Blue:
        break;
    }
    return 0;
}
</code></pre>
