title: static_assert with SFINAE
body: <p>The standard says in [temp.res]/8:</p>
  <blockquote>
  <p>No diagnostic shall be issued for a template definition for which a valid specialization can be generated. If no valid specialization can be generated for a template definition, and that template is not instantiated, the template definition is ill-formed, no diagnostic required. ... [ Note: If a template is instantiated, errors will be diagnosed according to the other rules in this Standard. Exactly when these errors are diagnosed is a quality of implementation issue. — end note ]</p>
  </blockquote>
  <p>My question is: Does the following count as a valid specialization that can be generated?</p>
  <pre><code>#include &lt;type_traits&gt;
  
  template &lt;typename T, typename Enable = void&gt;
  class A;
  
  template &lt;typename T&gt;
  class A&lt;T, typename std::enable_if&lt;not std::is_same&lt;T, int&gt;::value&gt;::type&gt;
  {
  public:
      static_assert(std::is_same&lt;T, int&gt;::value, &quot;should not be here!&quot;);
  };
  </code></pre>
  <p>On the one hand, the <code>static_assert</code> essentially amounts to a <code>static_assert(false, &quot;should not be here&quot;);</code> (we can't both not be an <code>int</code> and be an <code>int</code> at the same time), which isn't allowed. On the other hand, as far as SFINAE is concerned, the type, e.g., <code>A&lt;double&gt;</code> is perfectly well formed and can be generated, but will immediately throw a static assertion failure. This currently works in GCC 8.3, but given the &quot;ill-formed, no diagnostic required&quot; part of the standards quote above, I want to make sure that it actually <em><strong>should</strong></em> work. (Note: work here is defined to mean it throws a <code>static assertion</code> failed if I try to instantiate a <code>A&lt;double&gt;</code> and compiles silently if I don't)</p>