title: How to suppress ' left shift count >= width of type' warning in g++
body: <p>(My question is mostly the same as <a href="https://stackoverflow.com/questions/28281250/disable-spurious-warning-left-shift-count-width-of-type">this one</a>, but my needs are different, hence I need a different solution.)</p>
  
  <p>I am attempting to use test-driven development, and am writing a set of tests to validate the behavior of my <code>BIT(n)</code> macro:</p>
  
  <pre><code>#define BIT(n) ( ((uint64_t)1) &lt;&lt; (n) )
  </code></pre>
  
  <p>Since my test for the above includes both expected-pass and expected-fail components, I intentionally do bad things such as</p>
  
  <pre><code>MY_TEST_ASSERT(0 == (value64 = BIT(65)));
  </code></pre>
  
  <p>which, if there was a problem with my implementation if <code>BIT(n)</code>, would output something helpful like</p>
  
  <blockquote>
    <p>TEST FAILED: '0 == (value64 = BIT(65))' (file 'tests/002.bit-hackery.cpp', line 12))</p>
  </blockquote>
  
  <p>Everything works as expected, but I get an annoying warning during compilation:</p>
  
  <blockquote>
    <p>../../inc/bit-hackery.hpp:15:32: warning: left shift count >= width of
    type [enabled by default]</p>
  </blockquote>
  
  <p>(It is actually annoying for two reasons:  (1) I want it suppressed for this test code, since I am testing this situation on purpose, and (2) in real (non-test) code, I would rather it be treated as an error.  But, this question is about the former.)</p>
  
  <p>I've tried suppressing it with a <code>#pragma</code> directive, but I can't seem to find one that works:</p>
  
  <pre><code>#pragma GCC diagnostic push
  //#pragma GCC diagnostic ignored "-Wcomparison-fixed"
  //#pragma GCC diagnostic ignored "-Wtype-limits"
  //#pragma GCC diagnostic ignored "-Wextra"
  //#pragma GCC diagnostic ignored "-Wall"
    MY_TEST_ASSERT(0 != (value64 = BIT(65)));
  #pragma GCC diagnostic pop
  </code></pre>
  
  <p>Does anyone know how to suppress this particular warning?</p>
  
  <p>My compiler version is <code>g++ (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4</code></p>