title: c++ static_assert fails on both branches of an 'if constexpr statement'
body: <p>I'm trying to determine at compile time if a specific type is of type <strong>std::pair</strong>.
  When I compile the code below, I get the assertion fail on both branches (that is, both &quot;HERE1&quot;, and &quot;HERE2&quot;).
  If I remove the static_asserts and uncomment the prints, I get what I expect:
  That is &quot;HERE1&quot; for <strong>is_pair_type&lt;T::value_type&gt;</strong>, and &quot;HERE2&quot; for <strong>is_pair_type&lt; T &gt;</strong>.</p>
  <p>I guess this means the compiler can't evaluate the expression at compile time, but I don't understand why.</p>
  <p><strong>Using: MS VS2019, with MSVC version 14.29.30037</strong></p>
  <p>Thanks.</p>
  <pre><code>
  template&lt; class T &gt;             struct is_pair : std::false_type {};
  template&lt; class T1, class T2 &gt;  struct is_pair&lt; std::pair&lt; T1, T2 &gt; &gt; : std::true_type {};
  template&lt; class T &gt;             struct is_pair_d : is_pair&lt;typename std::decay&lt;T&gt;::type&gt; {};
  // a helper function for value
  template&lt;class T&gt; struct is_pair_type {
      static constexpr bool const value = is_pair_d&lt;T&gt;::value;
  };
  
  int main()
  {
      using T = std::map&lt;int, float&gt;;
      T blabla;
  
      if constexpr (is_pair_type&lt;T&gt;::value)
      {
          //std::cout &lt;&lt; &quot;HERE1&quot; &lt;&lt; &quot;\n&quot;;
          static_assert(false, &quot;HERE1&quot;);
      }
      else
      {
          //std::cout &lt;&lt; &quot;HERE2&quot; &lt;&lt; &quot;\n&quot;;
          static_assert(false, &quot;HERE2&quot;);
      }
      ...
  </code></pre>