title: Why shifting a negative value with literal is giving [-Wshift-negative-value] warning
body: <p>I am doing a bitwise left shift operation on negative number.</p>
  
  <pre><code>int main(void) {
      int count = 2;
      printf("%d\n", ~0&lt;&lt;count);
      printf("%d\n", ~0&lt;&lt;2); // warning:shifting a negative signed value is undefined [-Wshift-negative-value]
      return 0;
  }
  </code></pre>
  
  <p>My doubt is why the warning is coming on compiling above code when integer literal is used in shifting and not when variable is used.</p>