title: Can clang warn about undefined behavior at compile-time?
body: <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      int n = -1000;
      for (int i(0); i != n; ++i)
      {
      }
  }
  </code></pre>
  
  <p>In gcc the following error is caught at compile-time:</p>
  
  <pre><code>main.cpp:6:5: warning: iteration 2147483647u invokes undefined behavior [-Waggressive-loop-optimizations]
  
       for (int i(0); i != n; ++i)
  </code></pre>
  
  <p>Clang's <code>-fsanitize=undefined</code> is a run-time mechanism. What is clang's compile-time equivalent?</p>