When are class templates instantiated?
<p>Suppose you have the following (ill-formed) program:</p>

<pre><code>struct A
{
    A(int, int)
    {
    }
};

template &lt;typename T&gt;
class B
{
    B()
    {
        if (sizeof (T) == 1)
        {
            throw A(0); // wrong, A() needs two arguments
        }
    }
};

int main()
{
    return 0;
}
</code></pre>

<p>GCC compiles this program without any errors, clang++ refuses it with an error.</p>

<ol>
<li>Is it justified to say thats it is <em>not</em> a bug in GCC because the template isnt instantiated? </li>
<li>What magic does clang do to find this error?</li>
<li>What does the C++ standard say about those situations?</li>
</ol>
