title: constexpr operator overloading issues with using arguments
body: <p>I am making a simple class inheriting from std::array. The point is that it should throw a compile time error if the subscript operator is used for an out of bounds index. However, I keep getting an error message. This is the code simplified.</p>
  
  <pre><code>#include &lt;array&gt;
  
  using namespace std;
  
  template&lt;typename type, size_t size&gt;
  struct container : array&lt;type,size&gt;
  {
      constexpr inline type&amp; operator[](int index) const
      {
          static_assert(index&lt;size,"");
          return ((static_cast&lt;const array&lt;type,size&gt; &gt;(*this))[index]);
      }
  
      template&lt;class... bracelist&gt;
      constexpr container(bracelist&amp;&amp;... B)
      :array&lt;type,size&gt;{std::forward&lt;bracelist&gt;(B)...}
      {}
  
      container() = default;
  };
  
  int main()
  {
      constexpr container&lt;int,4&gt; myarray = {5,6,7,8};
      constexpr int number = myarray[2];
  }
  </code></pre>
  
  <p>The error it gives me is:</p>
  
  <pre><code>main.cpp|80|error: non-constant condition for static assertion
  main.cpp|80|error: 'index' is not a constant expression
  </code></pre>
  
  <p>However, I used "index" in the return statement, and commenting out the static_assert makes it work fine. If index was not a constant expression, wouldn't I not be able to use it in the subscript operator for std::array after the static_cast? I am new to using the constexpr functionality, so any help would be appreciated. Thank you.</p>
  
  <p>Note: I am aware std::array's constexpr subscript operator already does this, I just want to know how to do this for future uses. Thanks.</p>