title: static_assert in function template with non-type template parameter
body: <p>I have a function template with integer template parameter. I would like to provide an implementation for particular integers only. An attempt to use the function template with another argument should cause a compilation error.</p>
  
  <p>I used <code>static_assert</code> in a way presented below.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;type_traits&gt;
  #include &lt;iostream&gt;
  
  template &lt;typename T&gt;
  struct false_type : public std::false_type {};
  
  template &lt;int T&gt;
  void function() {
      static_assert(false_type&lt;decltype(T)&gt;::value, "Error");
  };
  
  template &lt;&gt;
  void function&lt;1&gt;() {
      std::cout &lt;&lt; 1 &lt;&lt; std::endl;
  }
  
  int main() {
      function&lt;1&gt;();
  }
  </code></pre>
  
  <p>The code works nicely until <code>gcc 9.1</code> where it gives an <code>error: static assertion failed</code>.</p>
  
  <p>I would like to know if there is a technique that would allow to ahieve my goal and that is compatible with <code>gcc 9.1</code>?</p>