title: What does the standard say about char arrays as template arguments?
body: <p>During my research for an answer for <a href="https://stackoverflow.com/q/57003010/9883438">this question</a> I found (I did not know that before) that gcc and clang allow <code>char</code> arrays to be template arguments if they are declared <code>static</code>. E.g. this code compiles with gcc and clang:</p>
  <pre><code>#include &lt;type_traits&gt;
  
  template &lt;int N, const char (&amp;string)[N]&gt;
  auto foo()
  {
      if constexpr (string[0] == 'i')
          return 0;
      else
          return 3.14f;
  }
  
  void bar()
  {
      static constexpr char string1[] = &quot;int&quot;;
      static constexpr char string2[] = &quot;float&quot;;
  
      auto i = foo&lt;sizeof(string1), string1&gt;();
      auto f = foo&lt;sizeof(string2), string2&gt;();
  
      static_assert(std::is_same_v&lt;decltype(i), int&gt;);
      static_assert(std::is_same_v&lt;decltype(f), float&gt;);
  }
  </code></pre>
  <p>MSVC also allows that. However, to make it work with MSVC, I have to declare the two strings in the global namespace. Then it works just as well.</p>
  <p>So my question is: What does the standard say about this? Which compiler (if any) is right?</p>
  <hr />
  <h2>Update:</h2>
  <p>This issue has been fixed in VS 2019 version 16.4 (msvc v19.24): <a href="https://developercommunity.visualstudio.com/content/problem/341639/very-fragile-ice.html" rel="nofollow noreferrer">https://developercommunity.visualstudio.com/content/problem/341639/very-fragile-ice.html</a></p>