title: Detect accidental elided dimension in C++
body: <p>Consider the following snippet:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int a[10][2];
  int b[10][2];
  
  int main(){
  
    //intended
    cout &lt;&lt; a[0][0] - b[0][0] &lt;&lt; endl;
  
    //left out dimension by mistake
    cout &lt;&lt; a[0] - b[0] &lt;&lt; endl;
  
  }
  </code></pre>
  
  <p>Obviously (or maybe not per comments) the second case is valid pointer arithmetic in both C and C++ but in the code base I am working with it is generally a semantic mistake; a dimension has usually been left out in a nested for loop.  Is there any -W flag or static analysis tool that can detect this? </p>