title: Do not use array subscript when the index is not an integer constant expression; use gsl::at() instead
body: <p>I was trying to create some example code in Microsoft Visual Studio which looks like that</p>
  
  <pre><code>int main()
  {
      const size_t size = 10;
      int arr[size];
  
      for (size_t i = 0; i &lt; size; ++i)
          arr[i] = i;
  
      return 0;
  }
  </code></pre>
  
  <p>Now JetBrains ResharperC++ emits the following warning in line <code>arr[i] = i;</code></p>
  
  <blockquote>
    <p><a href="https://i.stack.imgur.com/BCqnX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BCqnX.png" alt="enter image description here"></a>
    Do not use array subscript when the index is not an integer constant expression; use gsl::at() instead</p>
  </blockquote>
  
  <p>I fail to understand what I this means and how to resolve this warning. </p>
  
  <p>As this is a scheme I was using fairly often, I am a little concerned about the warning.</p>
  
  <p>Could anyone advice or point me in the right direction?</p>
  
  <p><strong>EDIT:</strong> Changing the loop to:</p>
  
  <pre><code>for (size_t i = 0; i &lt; size; ++i)
      arr[i] = 0;
  </code></pre>
  
  <p>still produces the warning.</p>